Package org.fryske_akademy.jpa
Enum OPERATOR
- java.lang.Object
-
- java.lang.Enum<OPERATOR>
-
- org.fryske_akademy.jpa.OPERATOR
-
- All Implemented Interfaces:
Serializable,Comparable<OPERATOR>
public enum OPERATOR extends Enum<OPERATOR>
A series of operators supported by this library, encapsulates all intelligence around them. Some of the operators may be determined from user input, for thesegetUserInput()} has a value.- See Also:
Param.Builder
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ANDNot an operator, it is here to support " AND " syntax in user valuesBETWEENEQGEGTINISBLANKcase-insensitive user inputISEMPTYfor empty collection! case-insensitive user inputISNOTBLANKcase-insensitive user inputISNOTEMPTYfor empty collection! case-insensitive user inputISNOTNULLcase-insensitive user inputISNULLcase-insensitive user inputLELIKELTMEMBEROFNEORNot an operator, it is here to support " OR " syntax in user values
-
Field Summary
Fields Modifier and Type Field Description static charNEGATION
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleaneq(String value)check if a string (user value) indicates a greater/smaller than or equal comparisonstatic OPERATORfromToken(String token)static OPERATORfromUserInput(String input)StringgetToken()StringgetUserInput()When null the OPERATOR cannot be determined from user inputstatic booleangreater(String value)check if a string (user value) indicates a greater than comparisonstatic booleanisAnd(String value)true when " AND " is found in the given string and it comes before an optional " OR " and there are at least two termsstatic booleanisBetween(String value)booleanisOperatorInUserInput(String input)Is this operator in user inputstatic booleanisOr(String value)true when " OR " is found in the given string and it comes before an optional " AND " and there are at least two termsstatic booleannegation(String value)check if a string (user value) indicates a negationstatic OPERATORoperator(String operator, String value, boolean syntaxInValue)Returns an operator from the value when syntaxInValue is true and the value contains one of the supported operators, otherwise the operator is determined from the operator argumentstatic booleanoperatorInUserInput(String input)Does user input contain an operatorstatic booleansmaller(String value)check if a string (user value) indicates a smaller than comparison.static StringstripSyntax(String value)Strip !, <, >, = at the beginning of a value in order to get the raw user supplied value.StringtoString()returns the token wrapped in spaces, so string concatenation in query building can be used.static booleanvalueIsOperator(String s, boolean syntaxInValue)users may input "(!)is null", "(!)is empty", "(!)is blank", in that case there is no parameter value to be set for a key.static OPERATORvalueOf(String name)Returns the enum constant of this type with the specified name.static OPERATOR[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
EQ
public static final OPERATOR EQ
-
GT
public static final OPERATOR GT
-
LT
public static final OPERATOR LT
-
GE
public static final OPERATOR GE
-
LE
public static final OPERATOR LE
-
IN
public static final OPERATOR IN
-
LIKE
public static final OPERATOR LIKE
-
NE
public static final OPERATOR NE
-
MEMBEROF
public static final OPERATOR MEMBEROF
-
BETWEEN
public static final OPERATOR BETWEEN
-
ISNULL
public static final OPERATOR ISNULL
case-insensitive user input
-
ISNOTNULL
public static final OPERATOR ISNOTNULL
case-insensitive user input
-
ISBLANK
public static final OPERATOR ISBLANK
case-insensitive user input
-
ISNOTBLANK
public static final OPERATOR ISNOTBLANK
case-insensitive user input
-
ISEMPTY
public static final OPERATOR ISEMPTY
for empty collection! case-insensitive user input
-
ISNOTEMPTY
public static final OPERATOR ISNOTEMPTY
for empty collection! case-insensitive user input
-
AND
public static final OPERATOR AND
Not an operator, it is here to support " AND " syntax in user values
-
OR
public static final OPERATOR OR
Not an operator, it is here to support " OR " syntax in user values
-
-
Field Detail
-
NEGATION
public static final char NEGATION
- See Also:
- Constant Field Values
-
-
Method Detail
-
values
public static OPERATOR[] 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 (OPERATOR c : OPERATOR.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static OPERATOR 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
-
negation
public static boolean negation(String value)
check if a string (user value) indicates a negation- Parameters:
value-- Returns:
- See Also:
NEGATION
-
stripSyntax
public static String stripSyntax(String value)
Strip !, <, >, = at the beginning of a value in order to get the raw user supplied value.- Parameters:
value-- Returns:
-
eq
public static boolean eq(String value)
check if a string (user value) indicates a greater/smaller than or equal comparison
-
greater
public static boolean greater(String value)
check if a string (user value) indicates a greater than comparison- Parameters:
value-- Returns:
- See Also:
GT
-
smaller
public static boolean smaller(String value)
check if a string (user value) indicates a smaller than comparison.- Parameters:
value-- Returns:
- See Also:
LT
-
valueIsOperator
public static boolean valueIsOperator(String s, boolean syntaxInValue)
users may input "(!)is null", "(!)is empty", "(!)is blank", in that case there is no parameter value to be set for a key.- Parameters:
s-syntaxInValue-- Returns:
-
isBetween
public static boolean isBetween(String value)
-
isAnd
public static boolean isAnd(String value)
true when " AND " is found in the given string and it comes before an optional " OR " and there are at least two terms- Parameters:
value-- Returns:
-
isOr
public static boolean isOr(String value)
true when " OR " is found in the given string and it comes before an optional " AND " and there are at least two terms- Parameters:
value-- Returns:
-
operator
public static OPERATOR operator(String operator, String value, boolean syntaxInValue)
Returns an operator from the value when syntaxInValue is true and the value contains one of the supported operators, otherwise the operator is determined from the operator argument- Parameters:
operator-value-syntaxInValue-- Returns:
-
toString
public String toString()
returns the token wrapped in spaces, so string concatenation in query building can be used.
-
getToken
public String getToken()
-
getUserInput
public String getUserInput()
When null the OPERATOR cannot be determined from user input- Returns:
-
isOperatorInUserInput
public boolean isOperatorInUserInput(String input)
Is this operator in user input- Parameters:
input-- Returns:
-
operatorInUserInput
public static boolean operatorInUserInput(String input)
Does user input contain an operator- Parameters:
input-- Returns:
- See Also:
isOperatorInUserInput(String)
-
-