public class VersionConstraints extends Object
Constructor and Description |
---|
VersionConstraints(String version,
String earliest,
String latest)
Creates a
VersionConstraints with the three optional constraint strings. |
Modifier and Type | Method and Description |
---|---|
String |
getEarliestConstraint()
Returns the lower-bound constraint string, which will be null if there is no lower-bound
constraint on the version.
|
String |
getLatestConstraint()
Returns the upper-bound constraint string, which will be null if there is no upper-bound
constraint on the version.
|
String |
getVersionConstraint()
Returns the matching constraint string, which will be null if there is no constraint on
matching the version.
|
static boolean |
isEarlier(String version,
String constraint)
Checks if the given version string is less-than or equal-to the constraint string.
|
static boolean |
isLater(String version,
String constraint)
Checks if the given version string is greater-than or equal-to the constraint string.
|
static boolean |
matches(String version,
String constraint)
Checks if the given version string matches the constraint string.
|
boolean |
meetsConstraint(String version)
Checks if the given version string meets all three constraints.
|
public VersionConstraints(String version, String earliest, String latest)
VersionConstraints
with the three optional constraint strings. Each of
the three strings must conform to the VersionMatchType type defined in the XACML schema. Any
of the strings may be null to specify that the given constraint is not used.version
- a matching constraint on the version or nullearliest
- a lower-bound constraint on the version or nulllatest
- an upper-bound constraint on the version or nullpublic String getVersionConstraint()
public String getEarliestConstraint()
public String getLatestConstraint()
public boolean meetsConstraint(String version)
version
- the version to compare, which is formatted as a VersionType XACML typepublic static boolean matches(String version, String constraint)
version
- the version string to checkconstraint
- a constraint string to use in matchingpublic static boolean isEarlier(String version, String constraint)
version
- the version string to checkconstraint
- a constraint string to use in matchingpublic static boolean isLater(String version, String constraint)
version
- the version string to checkconstraint
- a constraint string to use in matchingCopyright © 2024 WSO2. All rights reserved.