Package es.bsc.dataclay.util.filtering
Class Condition
- java.lang.Object
-
- es.bsc.dataclay.util.filtering.Condition
-
public final class Condition extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Condition.ConditionOp
Accepted operations for the condition check.static class
Condition.ConditionValueType
Accepted types for condition attributes.
-
Field Summary
Fields Modifier and Type Field Description static String
NESTED_ATTR_DELIMITER
-
Constructor Summary
Constructors Constructor Description Condition(String attribute, Condition.ConditionOp operation, String value)
Basic constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Predicate
asPredicate()
static String
buildMultiAndCondition(String[] attrs, Condition.ConditionOp[] ops, String[] values)
static String
buildMultiOrMultiAndCondition(String[][] attrs, Condition.ConditionOp[][] ops, String[][] values)
static String
buildStringCondition(String attr, Condition.ConditionOp op, String value)
boolean
matches(Object o)
Check if the object matches current condition.Comparable
valueAsObject(Class type)
Retrieve the object representing the value of the current condition, considering provided class type.
-
-
-
Field Detail
-
NESTED_ATTR_DELIMITER
public static String NESTED_ATTR_DELIMITER
-
-
Constructor Detail
-
Condition
public Condition(String attribute, Condition.ConditionOp operation, String value)
Basic constructor.
-
-
Method Detail
-
matches
public boolean matches(Object o)
Check if the object matches current condition.- Parameters:
o
- object to be checked.- Returns:
- true if the object matches current condition, false otherwise.
-
asPredicate
public Predicate asPredicate()
-
valueAsObject
public Comparable valueAsObject(Class type)
Retrieve the object representing the value of the current condition, considering provided class type.- Parameters:
type
- class to be considered for the object .- Returns:
- the value represented as an instance of the given type with the value of the condition.
- Throws:
DataClayException
- if the type is not supported.
-
buildStringCondition
public static String buildStringCondition(String attr, Condition.ConditionOp op, String value)
-
buildMultiAndCondition
public static String buildMultiAndCondition(String[] attrs, Condition.ConditionOp[] ops, String[] values)
-
buildMultiOrMultiAndCondition
public static String buildMultiOrMultiAndCondition(String[][] attrs, Condition.ConditionOp[][] ops, String[][] values)
-
-