Package com.im.ijc.cf.api
Enum CFOperator
- java.lang.Object
-
- java.lang.Enum<CFOperator>
-
- com.im.ijc.cf.api.CFOperator
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<CFOperator>
public enum CFOperator extends java.lang.Enum<CFOperator>
Operators used in conditional formatting expressions.- Author:
- Petr Hamernik
-
-
Enum Constant Summary
Enum Constants Enum Constant Description BETWEENOperator between two values.CONTAINSOperator "contains" for substrings - this is case sensitive.CONTAINS_CASE_INSENSITIVEOperator case insensitive "contains" for substrings.DOES_NOT_CONTAINOperator "does not contain" for substrings - this is case sensitive.DOES_NOT_CONTAIN_CASE_INSENSITIVEOperator case insensitive "does not contain" for substrings.DOES_NOT_END_WITHOperator "Does not end with" for text values.DOES_NOT_START_WITHOperator "Does not start with" for text values.ENDS_WITHOperator "Ends with" for text values.EQUALSOperator=.GREATER_THANOperator>.GREATER_THAN_OR_EQUALOperator>=.IS_DIVISIBLE_BYOperator Is divisible by (for numbers).IS_NOT_NULLOperator "is not null" - checks if the value is defined.IS_NULLOperator "is null" - checks if the value is not defined.LESS_THANOperator<.LESS_THAN_OR_EQUALOperator<=.NOT_EQUALSOperator<>(not equals).STARTS_WITHOperator "Starts with" for text values.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringareParamsValid(java.util.List<java.lang.Object> params)Additional validation of values beforeCFExpressionis created.java.lang.StringgetDisplayName()Get display name of the operator.intgetNumberOfParams()static com.google.common.collect.ImmutableList<CFOperator>getSupportedOperators(CFFieldType fieldType)Get list of operators which support this field type.static com.google.common.collect.ImmutableMap<CFFieldType,com.google.common.collect.ImmutableList<CFOperator>>getSupportedTypes()booleanisFieldTypeSupported(CFFieldType fieldType)Returns whether given field type is supported by this operator.booleanmatch(java.lang.Object[] exprValues, java.lang.Object value)Evaluates whether given values matches this operator with the given operands.static CFOperatorvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static CFOperator[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
LESS_THAN_OR_EQUAL
public static final CFOperator LESS_THAN_OR_EQUAL
Operator<=.
-
LESS_THAN
public static final CFOperator LESS_THAN
Operator<.
-
GREATER_THAN_OR_EQUAL
public static final CFOperator GREATER_THAN_OR_EQUAL
Operator>=.
-
GREATER_THAN
public static final CFOperator GREATER_THAN
Operator>.
-
EQUALS
public static final CFOperator EQUALS
Operator=.
-
NOT_EQUALS
public static final CFOperator NOT_EQUALS
Operator<>(not equals).
-
BETWEEN
public static final CFOperator BETWEEN
Operator between two values.
-
IS_DIVISIBLE_BY
public static final CFOperator IS_DIVISIBLE_BY
Operator Is divisible by (for numbers).
-
CONTAINS
public static final CFOperator CONTAINS
Operator "contains" for substrings - this is case sensitive.
-
DOES_NOT_CONTAIN
public static final CFOperator DOES_NOT_CONTAIN
Operator "does not contain" for substrings - this is case sensitive.
-
CONTAINS_CASE_INSENSITIVE
public static final CFOperator CONTAINS_CASE_INSENSITIVE
Operator case insensitive "contains" for substrings.
-
DOES_NOT_CONTAIN_CASE_INSENSITIVE
public static final CFOperator DOES_NOT_CONTAIN_CASE_INSENSITIVE
Operator case insensitive "does not contain" for substrings.
-
STARTS_WITH
public static final CFOperator STARTS_WITH
Operator "Starts with" for text values.
-
DOES_NOT_START_WITH
public static final CFOperator DOES_NOT_START_WITH
Operator "Does not start with" for text values.
-
ENDS_WITH
public static final CFOperator ENDS_WITH
Operator "Ends with" for text values.
-
DOES_NOT_END_WITH
public static final CFOperator DOES_NOT_END_WITH
Operator "Does not end with" for text values.
-
IS_NULL
public static final CFOperator IS_NULL
Operator "is null" - checks if the value is not defined.
-
IS_NOT_NULL
public static final CFOperator IS_NOT_NULL
Operator "is not null" - checks if the value is defined.
-
-
Method Detail
-
values
public static CFOperator[] 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 (CFOperator c : CFOperator.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static CFOperator valueOf(java.lang.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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
getDisplayName
public java.lang.String getDisplayName()
Get display name of the operator.- Returns:
- display name
-
getNumberOfParams
public int getNumberOfParams()
- Returns:
- the arity of this operator. I.e. the number of arguments (or operands) the operator accepts
-
isFieldTypeSupported
public boolean isFieldTypeSupported(CFFieldType fieldType)
Returns whether given field type is supported by this operator. For example>=operator supports onlyinteger type.- Parameters:
fieldType- field type to be checked- Returns:
- whether field type is supported
-
getSupportedOperators
public static com.google.common.collect.ImmutableList<CFOperator> getSupportedOperators(CFFieldType fieldType)
Get list of operators which support this field type.- Parameters:
fieldType- type of the field- Returns:
- list of supported operators for the field
-
getSupportedTypes
public static com.google.common.collect.ImmutableMap<CFFieldType,com.google.common.collect.ImmutableList<CFOperator>> getSupportedTypes()
-
match
public boolean match(java.lang.Object[] exprValues, java.lang.Object value)Evaluates whether given values matches this operator with the given operands.- Parameters:
exprValues- operandsvalue- value to be matched- Returns:
- whether the value matches
-
areParamsValid
public java.lang.String areParamsValid(java.util.List<java.lang.Object> params)
Additional validation of values beforeCFExpressionis created.Currently used only for:
BETWEENoperator to check that second value is greater or equal to first value.IS_DIVISIBLE_BY- should not divide by zero or negative number
- Parameters:
params- parameters to be validated- Returns:
- Error message (human presentable) if there is any problem, otherwise
null.
-
-