Class ExpressionFluentHelper<EntityT>
- Type Parameters:
EntityT
- VdmObject that the expression is operating on.
and
and or
as methods in this class.
Negation can be achieved by not
. Every logical operator creates and returns a new instance based on
the original expression object. Instantiating objects from this class directly can cause undefined results.- See Also:
-
Constructor Summary
ConstructorDescriptionExpressionFluentHelper
(ValueBoolean delegateExpression) Creates a new helper based on an arbitrary, untyped filter expression. -
Method Summary
Modifier and TypeMethodDescriptionand
(ExpressionFluentHelper<EntityT> conjunctExpression) Boolean AND expression fluent helper.not()
Boolean NOT expression fluent helper.static <T> ExpressionFluentHelper<T>
not
(ExpressionFluentHelper<T> expression) Boolean NOT expression fluent helper.or
(ExpressionFluentHelper<EntityT> disjunctExpression) Boolean OR expression fluent helper.
-
Constructor Details
-
ExpressionFluentHelper
Creates a new helper based on an arbitrary, untyped filter expression.Instances of this class can be used to pass an unchecked
ValueBoolean
to fluent helpers. This approach discards type safety and is generally discouraged.- Parameters:
delegateExpression
- The expression to delegate to.
-
-
Method Details
-
or
@Nonnull public ExpressionFluentHelper<EntityT> or(@Nonnull ExpressionFluentHelper<EntityT> disjunctExpression) Boolean OR expression fluent helper.
Please note:
Filter expressions chained together by logical operators are interpreted in the same order as their corresponding methods are called. Since the Java language evaluates method calls from left to right, the fluent API design is following the same principle. The implicit precedence is following the method invocation and not the underlying, logical operators:A.or(B).and(C) <=> (A.or(B)).and(C)
Recommendation:
Incorporate parentheses or introduce variables to reflect combined expressions:var AorB = A.or(B) AorB.and(C)
- Parameters:
disjunctExpression
- Other expression to combine with.- Returns:
- Fluent helper that represents a ((this) || other) expression.
-
and
@Nonnull public ExpressionFluentHelper<EntityT> and(@Nonnull ExpressionFluentHelper<EntityT> conjunctExpression) Boolean AND expression fluent helper.
Please note:
Filter expressions chained together by logical operators are interpreted in the same order as their corresponding methods are called. Since the Java language evaluates method calls from left to right, the fluent API design is following the same principle. The implicit precedence is following the method invocation and not the underlying, logical operators:A.or(B).and(C) <=> (A.or(B)).and(C)
Recommendation:
Incorporate parentheses or introduce variables to reflect combined expressions:var AorB = A.or(B) AorB.and(C)
- Parameters:
conjunctExpression
- Other expression to combine with.- Returns:
- Fluent helper that represents a ((this) && other) expression.
-
not
Boolean NOT expression fluent helper.- Returns:
- Fluent helper that represents a not(this) expression.
-
not
@Nonnull public static <T> ExpressionFluentHelper<T> not(@Nonnull ExpressionFluentHelper<T> expression) Boolean NOT expression fluent helper.- Type Parameters:
T
- The type argument for the returnedExpressionFluentHelper
- Parameters:
expression
- expression to be negated.- Returns:
- Fluent helper that represents a not(expression) expression.
-