Enum CmpOperator
- java.lang.Object
-
- java.lang.Enum<CmpOperator>
-
- de.aristaflow.adept2.model.logmanagement.CmpOperator
-
- All Implemented Interfaces:
Serializable
,Comparable<CmpOperator>
public enum CmpOperator extends Enum<CmpOperator>
An enumeration that defines the comparison operations supported by the log management facility, aka. log manager.- Author:
- Patrick Schmidt
-
-
Enum Constant Summary
Enum Constants Enum Constant Description EQUAL
the "equals" operatorGREATER_THAN
the "greater than" operatorGREATER_THAN_OR_EQUAL
the "greater than or equal" operatorLESS_THAN
the "less than" operatorLESS_THAN_OR_EQUAL
the "less than or equal" operatorLIKE
The "like" operator works like SQL's LIKE operator.LIKE_IGNORECASE
A case insensitive version ofLIKE
.NOT_EQUAL
the "not equals" operatorNOT_LIKE
A negatedLIKE
operator.NOT_LIKE_IGNORECASE
A case insensitive version ofNOT_LIKE
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canCompare(DataType dataType)
Returns whether this comparison operator can generally work on the given data type.boolean
canCompare(DataType columnDataType, DataType valueDataType)
Returns whether this operator can compare the two given data types.static CmpOperator
getCmpOperatorForSymbol(String symbol)
Returns the comparison operator to which the given symbol belongs ornull
if the symbol is not recognised.String
getSymbol()
Returns this comparison operator's associated symbol.static CmpOperator
valueOf(String name)
Returns the enum constant of this type with the specified name.static CmpOperator[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
EQUAL
public static final CmpOperator EQUAL
the "equals" operator
-
NOT_EQUAL
public static final CmpOperator NOT_EQUAL
the "not equals" operator
-
GREATER_THAN
public static final CmpOperator GREATER_THAN
the "greater than" operator
-
GREATER_THAN_OR_EQUAL
public static final CmpOperator GREATER_THAN_OR_EQUAL
the "greater than or equal" operator
-
LESS_THAN
public static final CmpOperator LESS_THAN
the "less than" operator
-
LESS_THAN_OR_EQUAL
public static final CmpOperator LESS_THAN_OR_EQUAL
the "less than or equal" operator
-
LIKE
public static final CmpOperator LIKE
The "like" operator works like SQL's LIKE operator._
is a placeholder for exactly one character;%
is a placeholder for an arbitrary number of characters (even zero). Only works on strings.
-
NOT_LIKE
public static final CmpOperator NOT_LIKE
A negatedLIKE
operator. Only works on strings.
-
LIKE_IGNORECASE
public static final CmpOperator LIKE_IGNORECASE
-
NOT_LIKE_IGNORECASE
public static final CmpOperator NOT_LIKE_IGNORECASE
-
-
Method Detail
-
values
public static CmpOperator[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (CmpOperator c : CmpOperator.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CmpOperator valueOf(String name)
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
-
getSymbol
public String getSymbol()
Returns this comparison operator's associated symbol.- Returns:
- this comparison operator's associated symbol
-
getCmpOperatorForSymbol
public static CmpOperator getCmpOperatorForSymbol(String symbol)
Returns the comparison operator to which the given symbol belongs ornull
if the symbol is not recognised.- Parameters:
symbol
- the symbol for which to find the comparison operator- Returns:
- the comparison operator for this symbol or
null
-
canCompare
public boolean canCompare(DataType dataType)
Returns whether this comparison operator can generally work on the given data type. If it can, this at least guarantees that it can compare two values of this same type. If the parameter isnull
this method will determine if the operator can deal withnull
values (at the time of writing, onlyEQUAL
andNOT_EQUAL
can do that).- Parameters:
dataType
- the data type to be tested- Returns:
- whether this comparison operator can generally work on the given data type
-
canCompare
public boolean canCompare(DataType columnDataType, DataType valueDataType)
Returns whether this operator can compare the two given data types. The left-hand data type is the data type of a column and must therefore never benull
. The right-hand data type is the data type of the value ornull
if the value itself isnull
. At the time of writing, onlyEQUAL
andNOT_EQUAL
can compare anull
-value to the value of a column.- Parameters:
columnDataType
- the left-hand data type (which should be the column's data type)valueDataType
- the right-hand data type (which should be the value object's data type ornull
)- Returns:
- whether this operator can compare the two given data types
-
-