Class EzlibLoader.Condition<T>
java.lang.Object
com.saicone.ezlib.EzlibLoader.Condition<T>
- Type Parameters:
T- the type of objects that may be compared.
- Enclosing class:
EzlibLoader
Supplied condition script evaluator.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intExpected value representation for number equal than actual value.static final intExpected value representation for number greater than actual value.static final intExpected value representation for number greater than or equal to actual value.static final intExpected value representation for number less than actual value.static final intExpected value representation for number less than or equal to actual value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanEvaluate if expected result is the same after compare converted string value.Get the comparator that return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the expected value.Get the mapper function that convert string into required value.static EzlibLoader.Condition<Boolean> valueOf(boolean bool) Create a condition with a defined boolean value.static EzlibLoader.Condition<String> Create a condition using a string comparator.static EzlibLoader.Condition<Byte> valueOfByte(Supplier<Byte> supplier) Create a condition that compares a supplied byte value.static EzlibLoader.Condition<Double> valueOfDouble(Supplier<Double> supplier) Create a condition that compares a supplied double value.static EzlibLoader.Condition<Float> valueOfFloat(Supplier<Float> supplier) Create a condition that compares a supplied float value.static EzlibLoader.Condition<Integer> valueOfInteger(Supplier<Integer> supplier) Create a condition that compares a supplied integer value.static EzlibLoader.Condition<Long> valueOfLong(Supplier<Long> supplier) Create a condition that compares a supplied long value.static EzlibLoader.Condition<Short> valueOfShort(Supplier<Short> supplier) Create a condition that compares a supplied short value.
-
Field Details
-
LESS
public static final int LESSExpected value representation for number less than actual value.- See Also:
-
LESS_OR_EQUAL
public static final int LESS_OR_EQUALExpected value representation for number less than or equal to actual value.- See Also:
-
EQUAL
public static final int EQUALExpected value representation for number equal than actual value.- See Also:
-
GREATER_OR_EQUAL
public static final int GREATER_OR_EQUALExpected value representation for number greater than or equal to actual value.- See Also:
-
GREATER
public static final int GREATERExpected value representation for number greater than actual value.- See Also:
-
-
Constructor Details
-
Condition
Constructs a condition using the provided string mapper and type comparator.- Parameters:
mapper- the mapper function that convert string into required value.comparator- the comparator that return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the expected value.
-
-
Method Details
-
valueOf
Create a condition with a defined boolean value.- Parameters:
bool- the value that represent the state of the condition.- Returns:
- a newly generated condition.
-
valueOf
Create a condition using a string comparator.- Parameters:
condition- the comparator that evaluates a string.- Returns:
- a newly generated condition.
-
valueOfByte
Create a condition that compares a supplied byte value.- Parameters:
supplier- the supplier that return the expected value.- Returns:
- a newly generated condition.
-
valueOfShort
Create a condition that compares a supplied short value.- Parameters:
supplier- the supplier that return the expected value.- Returns:
- a newly generated condition.
-
valueOfInteger
Create a condition that compares a supplied integer value.- Parameters:
supplier- the supplier that return the expected value.- Returns:
- a newly generated condition.
-
valueOfLong
Create a condition that compares a supplied long value.- Parameters:
supplier- the supplier that return the expected value.- Returns:
- a newly generated condition.
-
valueOfFloat
Create a condition that compares a supplied float value.- Parameters:
supplier- the supplier that return the expected value.- Returns:
- a newly generated condition.
-
valueOfDouble
Create a condition that compares a supplied double value.- Parameters:
supplier- the supplier that return the expected value.- Returns:
- a newly generated condition.
-
getMapper
-
getComparator
-
eval
Evaluate if expected result is the same after compare converted string value.- Parameters:
expected- the expected result of comparator function.s- the string to convert and evaluate.- Returns:
- true if the expected result is the same as the actual result.
-