Skip to content

Commit

Permalink
Allow getting all expressions of an ExpressionList (#142)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLimeGlass authored Oct 31, 2023
1 parent 6ef60fa commit a2659f8
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
*/
@SuppressWarnings("unchecked")
public class ExpressionList<T> implements Expression<T> {
protected final boolean single;
protected boolean and;

protected Expression<? extends T>[] expressions;
private final Class<T> returnType;

@Nullable
private final ExpressionList<?> source;
private final Class<T> returnType;
protected final boolean single;
protected boolean and;

public ExpressionList(Expression<? extends T>[] expressions, Class<T> returnType, boolean and) {
this(expressions, returnType, and, null);
Expand Down Expand Up @@ -64,6 +66,14 @@ public T[] getValues(TriggerContext ctx) {
return getValues(expr -> expr.getValues(ctx));
}

/**
* Retrieves all {@link Expression}s within this ExpressionList.
* @return all {@link Expression}s relating to this ExpressionList.
*/
public Expression<? extends T>[] getExpressions() {
return expressions;
}

/**
* Retrieves all values of this Expression using a function that will be applied to each expression.
* @param function the function
Expand Down Expand Up @@ -196,4 +206,5 @@ public void setAndList(boolean isAndList) {
public Expression<?> getSource() {
return source != null ? source : this;
}

}

0 comments on commit a2659f8

Please sign in to comment.