Package com.sap.cds.ql.cqn
Interface Modifier
@Beta
public interface Modifier
Provider interface for modifying CQN
Predicates,
Values and Statements copied with
CQL.copy.
Override the default methods to replace specific parts of the statement /
predicate.-
Method Summary
Modifier and TypeMethodDescriptiondefault CqnPredicatebooleanFunction(String name, List<Value<?>> args) Override this method to replace a predicatefunctioncall.default CqnPredicatecomparison(Value<?> lhs, CqnComparisonPredicate.Operator op, Value<?> rhs) Override this method to replace acomparisonpredicate.default CqnPredicateconnective(CqnConnectivePredicate.Operator op, List<Predicate> predicates) Override this method to replace a logicalconnectionpredicate, which connects multiple predicates with the givenoperator.default CqnPredicatecontainment(CqnContainmentTest.Position position, CqnValue value, CqnValue term, boolean caseInsensitive) Override this method to replace acontainmenttest predicate.default booleandistinct(boolean distinct) Override this method to modify theexclude listofSelectstatements.default CqnPredicateOverride this method to replace anexistsubquery.default CqnSelectListItemOverride this method to replaceexpandlists.default CqnValueexpression(Value<Number> left, CqnArithmeticExpression.Operator op, Value<Number> right, String type) Override this method to replace anarithmeticexpression.default CqnValueOverride this method to replace afunctioncall.default CqnPredicatedefault CqnPredicateOverride this method to replace aninpredicate that checks if the givenvalueis equal to any value in thevalueSet.default CqnSelectListItemOverride this method to replaceinlinelists.default booleaninlineCount(boolean inlineCount) Override this method to set theinline countflag ofSelectstatements.default List<CqnSelectListItem>items(List<CqnSelectListItem> items) default CqnValuedefault CqnValueliteral(CqnLiteral<?> value) default CqnPredicatematch(CqnMatchPredicate match) Override this method to replace amatchpredicate.default CqnPredicateOverride this method to replace a logicalnegation.default List<CqnSortSpecification>orderBy(List<CqnSortSpecification> sortSpecs) default CqnValueparameter(CqnParameter param) Override this method to replaceparameters.default CqnValuedefault CqnValueref(CqnElementRef ref) default CqnStructuredTypeRefref(CqnStructuredTypeRef ref) Override this method to replace astructured type ref.default CqnPredicatedefault CqnPredicateOverride this method to replace asearchpredicate.searchableElements(Set<String> searchableElements) Override this method to set thesearchableelements ofSelectstatements.default List<CqnSelectListItem>default CqnSelectListItemselectListValue(Value<?> value, String alias) default longskip(long skip) default CqnSortSpecificationsort(Value<?> value, CqnSortSpecification.Order order) default longtop(long top) default CqnPredicateOverride this method to set thewhereclause offilterablestatements.
-
Method Details
-
ref
Override this method to replace astructured type ref.- Parameters:
ref- the immutableCqnStructuredTypeRef- Returns:
- the replacement ref
- See Also:
-
ref
- Parameters:
ref- the immutableCqnElementRef- Returns:
- a
valuereplacing the ref - See Also:
-
literal
- Parameters:
value- the immutableCqnLiteralvalue- Returns:
- a
valuereplacing theCqnLiteral - See Also:
-
parameter
Override this method to replaceparameters.- Parameters:
param- theCqnParameter- Returns:
- a
CqnValuereplacing theparameter
-
plain
-
list
- Parameters:
values- the list ofvalues- Returns:
- a
CqnValuereplacing theCqnListValue - See Also:
-
expression
default CqnValue expression(Value<Number> left, CqnArithmeticExpression.Operator op, Value<Number> right, String type) Override this method to replace anarithmeticexpression.- Parameters:
left- the left-hand side of the expressionop- the operatorright- the right-hand side of the expressiontype- the return type of the expression- Returns:
- a
CqnValuereplacing the arithmetic expression - See Also:
-
function
Override this method to replace afunctioncall.- Parameters:
name- the name of the functionargs- the arguments of the functiontype- the return type of the function call- Returns:
- a
CqnValuereplacing the function call - See Also:
-
booleanFunction
Override this method to replace a predicatefunctioncall.- Parameters:
name- the name of the functionargs- the arguments of the function- Returns:
- a
CqnPredicatereplacing the Boolean function call - See Also:
-
comparison
Override this method to replace acomparisonpredicate.- Parameters:
lhs- the left-hand side of the comparisonop- the comparison operatorrhs- the right-hand side of the comparison- Returns:
- a
CqnPredicatereplacing the comparison - See Also:
-
in
Override this method to replace aninpredicate that checks if the givenvalueis equal to any value in thevalueSet.- Parameters:
value- the value to be checked if it's contained in the setvalueSet- thevalue set- Returns:
- a
CqnPredicatereplacing theCqnInPredicate - See Also:
-
connective
Override this method to replace a logicalconnectionpredicate, which connects multiple predicates with the givenoperator.- Parameters:
op- the connective operator (AND/OR)predicates- the list of connected predicates- Returns:
- a
CqnPredicatereplacing the logical connection - See Also:
-
negation
Override this method to replace a logicalnegation.- Parameters:
predicate- thepredicateof the negation- Returns:
- a
CqnPredicatereplacing the negation - See Also:
-
exists
Override this method to replace anexistsubquery.- Parameters:
subQuery- thequeryof the exists predicate- Returns:
- a
CqnPredicatereplacing theCqnExistsSubquery - See Also:
-
match
Override this method to replace amatchpredicate.- Parameters:
match- thematchpredicate- Returns:
- a
CqnPredicatereplacing theCqnMatchPredicate - See Also:
-
containment
default CqnPredicate containment(CqnContainmentTest.Position position, CqnValue value, CqnValue term, boolean caseInsensitive) Override this method to replace acontainmenttest predicate.- Parameters:
position- thepositionvalue- the stringvalueterm- thetermto test forcaseInsensitive- whether the test should becase insensitive- Returns:
- a
CqnPredicatereplacing theCqnContainmentTest - See Also:
-
search
Override this method to replace asearchpredicate.- Parameters:
term- the search term- Returns:
- a
CqnPredicatereplacing theCqnSearchPredicate - See Also:
-
where
Override this method to set thewhereclause offilterablestatements.- Parameters:
where- thewhereclause of the statement, or null- Returns:
- a
CqnPredicatereplacing the where clause
-
search
- Parameters:
search- thesearchclause of the statement, or null- Returns:
- a
CqnPredicatereplacing the search clause
-
searchableElements
Override this method to set thesearchableelements ofSelectstatements.- Parameters:
searchableElements- the searchable elements of the statement- Returns:
- the set of searchable elements
-
inline
Override this method to replaceinlinelists. UseCQL.to(segments).inline(items)to create a newinline.- Parameters:
inline- theCqnInline- Returns:
- a
CqnSelectListItemreplacing theinline
-
expand
Override this method to replaceexpandlists. To create a new expand, useCQL.to(segments).expand(items). To create a modifiable copy of the expand, useCQL.copy(expand).- Parameters:
expand- theCqnExpand- Returns:
- a
CqnSelectListItemreplacing theexpand
-
selectListValue
- Parameters:
value- the valuealias- the alias- Returns:
- a
CqnSelectListItemreplacing thevalue
-
selectAll
- Returns:
- a
CqnSelectListItemreplacing theasterisk
-
items
- Parameters:
items- the list of selecteditems- Returns:
- the new list of items
-
excluding
Override this method to modify theexclude listofSelectstatements.- Parameters:
excluding- the names of the excluded elements- Returns:
- a set of names to be excluded from the Select result
-
groupBy
- Parameters:
values- the groupBy list of the Select statement- Returns:
- a list of values to group by
-
having
- Parameters:
having- the having clause of the Select statement- Returns:
- a
Predicatereplacing the having clause
-
orderBy
- Parameters:
sortSpecs- the orderBy list of the Select statement- Returns:
- a list of
CqnSortSpecificationdefining the order of the result
-
sort
- Parameters:
value- the value of the sort specorder- the sortorder- Returns:
- a sort spec
- See Also:
-
distinct
default boolean distinct(boolean distinct) - Parameters:
distinct- thedistinctflag of the Select statement- Returns:
- the new
distinctflag
-
inlineCount
default boolean inlineCount(boolean inlineCount) Override this method to set theinline countflag ofSelectstatements.- Parameters:
inlineCount- theinline countflag of the Select statement- Returns:
- the new
inline countflag
-
top
default long top(long top) - Parameters:
top- thetoplimit of the Select statement- Returns:
- the new maximum number of rows to be selected or -1 for unlimited
-
skip
default long skip(long skip) - Parameters:
skip- theskipnumber of the Select statement- Returns:
- the new number of rows that shall be skipped
-