Enum ValidWhenComparison
- All Implemented Interfaces:
Serializable,Comparable<ValidWhenComparison>,java.lang.constant.Constable
Enum for comparing two values.
- Since:
- Struts 1.4.1
- Author:
- Graff Stefan
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionCompare V1 == V2Compare V1 >= V2Compare V1 > V2Compare V1 <= V2Compare V1 < V2Compare V1 != V2 -
Method Summary
Modifier and TypeMethodDescriptionbooleancompare(ValidWhenResult<?> v1, ValidWhenResult<?> v2) Compares twovalues with consideration ofValidWhenComparison.protected abstract booleancompareTo(int compareTo) Method for the correct interpretation of the return-value ofcompareTo, depending onValidWhenComparison.protected <T extends Comparable<T>>
booleancompareTo(T v1, T v2) Method to compare twovalues, neither of which isnull.protected booleancompareWithNull(Object v1, Object v2) Method to compare twovalueswhere at least one of them isnull.static ValidWhenComparisongetComp(int tokenNum) Get theValidWhenComparisonfor given token-number.static ValidWhenComparisonReturns the enum constant of this type with the specified name.static ValidWhenComparison[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
LESS_EQUAL
Compare V1 <= V2 -
LESS_THAN
Compare V1 < V2 -
EQUAL
Compare V1 == V2 -
GREATER_THAN
Compare V1 > V2 -
GREATER_EQUAL
Compare V1 >= V2 -
NOT_EQUAL
Compare V1 != V2
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
getComp
Get theValidWhenComparisonfor given token-number.- Parameters:
tokenNum- the token-number- Returns:
- the
ValidWhenComparisonornullwhen not found
-
compareWithNull
Method to compare twovalueswhere at least one of them isnull.- Parameters:
v1- first valuev2- second value- Returns:
trueorfalsedepending of theValidWhenComparison
-
compareTo
Method to compare twovalues, neither of which isnull.- Parameters:
v1- first valuev2- second value- Returns:
trueorfalsedepending of theValidWhenComparison
-
compareTo
protected abstract boolean compareTo(int compareTo) Method for the correct interpretation of the return-value ofcompareTo, depending onValidWhenComparison.- Parameters:
compareTo- the return-value ofcompareTo- Returns:
trueorfalsedepending of theValidWhenComparison
-
compare
Compares twovalues with consideration ofValidWhenComparison.Following the comparing-steps:
- Tests whether at least one value is
null. If so, then it is only possible to compare for (non)-equality. - Try to convert both values into numbers and compares them.
- Compares both values as
Strings.
- Parameters:
v1- first valuev2- second value- Returns:
trueorfalsedepending of theValidWhenComparison
- Tests whether at least one value is
-