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 ConstantDescriptionCompare V1 == V2Compare V1 >= V2Compare V1 > V2Compare V1 <= V2Compare V1 < V2Compare V1 != V2 -
Method Summary
Modifier and TypeMethodDescriptionboolean
compare
(ValidWhenResult<?> v1, ValidWhenResult<?> v2) Compares twovalue
s with consideration ofValidWhenComparison
.protected abstract boolean
compareTo
(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 boolean
compareWithNull
(Object v1, Object v2) Method to compare twovalues
where at least one of them isnull
.static ValidWhenComparison
getComp
(int tokenNum) Get theValidWhenComparison
for given token-number.static ValidWhenComparison
Returns 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 theValidWhenComparison
for given token-number.- Parameters:
tokenNum
- the token-number- Returns:
- the
ValidWhenComparison
ornull
when not found
-
compareWithNull
Method to compare twovalues
where at least one of them isnull
.- Parameters:
v1
- first valuev2
- second value- Returns:
true
orfalse
depending of theValidWhenComparison
-
compareTo
Method to compare twovalues
, neither of which isnull
.- Parameters:
v1
- first valuev2
- second value- Returns:
true
orfalse
depending 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:
true
orfalse
depending of theValidWhenComparison
-
compare
Compares twovalue
s 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
String
s.
- Parameters:
v1
- first valuev2
- second value- Returns:
true
orfalse
depending of theValidWhenComparison
- Tests whether at least one value is
-