Class BaseOperator<F extends Filter>
java.lang.Object
com.tangosol.coherence.dslquery.operator.BaseOperator<F>
- Direct Known Subclasses:
AdditionOperator
,AndOperator
,BetweenOperator
,ComparisonOperator
,ContainsAllOperator
,ContainsAnyOperator
,ContainsOperator
,DivisionOperator
,InOperator
,LikeOperator
,MultiplicationOperator
,OrOperator
,SubtractionOperator
,XorOperator
A base class for CohQL Operator implementations.
- Since:
- Coherence 12.2.1
- Author:
- jk 2013.12.03
-
Field Summary
Modifier and TypeFieldDescriptionprotected final String[]
An array of optional aliases for this operator.protected final boolean
Flag indicating whether this operator can be used as a conditional operator, for example ==, >=, etc, as opposed to a non-conditional operator such as +, -, etc.protected final String
The symbol for this operator. -
Constructor Summary
ModifierConstructorDescriptionprotected
BaseOperator
(String sSymbol, boolean fConditional, String... asAlias) Create an instance of a BaseOperator with the specified symbol, conditional flag and aliases. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addAliases
(TokenTable tokenTable) Add any aliases of this operator to the specified token table.abstract void
addToTokenTable
(TokenTable tokenTable) Add this operator to the givenTokenTable
.String[]
Return the alternative symbols to use in CohQL that represent this operator.Return the symbol to use in CohQL that represents this operator.boolean
Return true if this operator can be used as a conditional operator.makeExtractor
(Term termLeft, Term termRight, TermWalker walker) makeExtractor
(Object oLeft, Object oRight) Create aValueExtractor
for thisBaseOperator
using the specified left and right values.makeFilter
(Term termLeft, Term termRight, TermWalker walker) makeFilter
(Object oLeft, Object oRight) Create aFilter
for thisBaseOperator
using the specified left and right values.toString()
protected static Set
unmodifiableSet
(Object oValue) Return an immutable Set accounting for the provided object being an array, a Collection or a single item in the returned Set.
-
Field Details
-
f_sSymbol
The symbol for this operator. -
f_asAlias
An array of optional aliases for this operator. -
f_fConditional
protected final boolean f_fConditionalFlag indicating whether this operator can be used as a conditional operator, for example ==, >=, etc, as opposed to a non-conditional operator such as +, -, etc.
-
-
Constructor Details
-
BaseOperator
Create an instance of a BaseOperator with the specified symbol, conditional flag and aliases.- Parameters:
sSymbol
- the symbol for this operatorfConditional
- a flag indicating whether this operator is conditionalasAlias
- an optional list of aliases for this operator
-
-
Method Details
-
getSymbol
Return the symbol to use in CohQL that represents this operator.- Returns:
- the symbol to use in CohQL that represents this operator
-
getAliases
Return the alternative symbols to use in CohQL that represent this operator.- Returns:
- the alternative symbols to use in CohQL that represent this operator
-
makeFilter
Create aFilter
for thisBaseOperator
using the specified left and rightTerm
s.Note: This method should be thread safe as operators are stored in a static map so may be called by multiple threads.
- Parameters:
termLeft
- the left term to use to build a FiltertermRight
- the right term to use to build a Filterwalker
- theTermWalker
to use to process the left and right terms- Returns:
- a Filter representing this operation.
-
makeFilter
Create aFilter
for thisBaseOperator
using the specified left and right values.Note: This method should be thread safe as operators are stored in a static map so may be called by multiple threads.
- Parameters:
oLeft
- the left value to use to build a FilteroRight
- the right value to use to build a Filter- Returns:
- a Filter representing this operation
-
makeExtractor
Create aValueExtractor
for thisBaseOperator
using the specified left and rightTerm
s.Note: This method should be thread safe as operators are stored in a static map so may be called by multiple threads.
- Parameters:
termLeft
- the left term to use to build a ValueExtractortermRight
- the right term to use to build a ValueExtractorwalker
- theTermWalker
to use to process the left and right terms- Returns:
- a ValueExtractor representing this operation
-
makeExtractor
Create aValueExtractor
for thisBaseOperator
using the specified left and right values.Note: This method should be thread safe as operators are stored in a static map so may be called by multiple threads.
- Parameters:
oLeft
- the left value to use to build a ValueExtractoroRight
- the right value to use to build a ValueExtractor- Returns:
- a ValueExtractor representing this operation
-
isConditional
public boolean isConditional()Return true if this operator can be used as a conditional operator.- Returns:
- true if this operator can be used as a conditional operator
-
addToTokenTable
Add this operator to the givenTokenTable
. This typically means adding this operator using its symbol and also adding any aliases.- Parameters:
tokenTable
- the TokenTable to add this operator to
-
toString
-
addAliases
Add any aliases of this operator to the specified token table.- Parameters:
tokenTable
- the token table to add aliases to
-
unmodifiableSet
Return an immutable Set accounting for the provided object being an array, a Collection or a single item in the returned Set.- Parameters:
oValue
- either an object array, a collection or a single item to be returned as a Set- Returns:
- a Set contained the provided object
-