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
public abstract class BaseOperator<F extends Filter> extends Object
A base class for CohQL Operator implementations.- Since:
- Coherence 12.2.1
- Author:
- jk 2013.12.03
-
-
Field Summary
Fields Modifier and Type Field Description protected String[]
f_asAlias
An array of optional aliases for this operator.protected boolean
f_fConditional
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 String
f_sSymbol
The symbol for this operator.
-
Constructor Summary
Constructors Modifier Constructor Description protected
BaseOperator(String sSymbol, boolean fConditional, String... asAlias)
Create an instance of a BaseOperator with the specified symbol, conditional flag and aliases.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected 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[]
getAliases()
Return the alternative symbols to use in CohQL that represent this operator.String
getSymbol()
Return the symbol to use in CohQL that represents this operator.boolean
isConditional()
Return true if this operator can be used as a conditional operator.ValueExtractor
makeExtractor(Term termLeft, Term termRight, TermWalker walker)
ValueExtractor
makeExtractor(Object oLeft, Object oRight)
Create aValueExtractor
for thisBaseOperator
using the specified left and right values.F
makeFilter(Term termLeft, Term termRight, TermWalker walker)
F
makeFilter(Object oLeft, Object oRight)
Create aFilter
for thisBaseOperator
using the specified left and right values.String
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 Detail
-
f_sSymbol
protected final String f_sSymbol
The symbol for this operator.
-
f_asAlias
protected final String[] f_asAlias
An array of optional aliases for this operator.
-
f_fConditional
protected final boolean f_fConditional
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.
-
-
Constructor Detail
-
BaseOperator
protected BaseOperator(String sSymbol, boolean fConditional, String... asAlias)
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 Detail
-
getSymbol
public String getSymbol()
Return the symbol to use in CohQL that represents this operator.- Returns:
- the symbol to use in CohQL that represents this operator
-
getAliases
public String[] 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
public F makeFilter(Term termLeft, Term termRight, TermWalker walker)
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
public F makeFilter(Object oLeft, Object oRight)
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
public ValueExtractor makeExtractor(Term termLeft, Term termRight, TermWalker walker)
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
public ValueExtractor makeExtractor(Object oLeft, Object oRight)
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
public abstract void addToTokenTable(TokenTable tokenTable)
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
-
addAliases
protected void addAliases(TokenTable tokenTable)
Add any aliases of this operator to the specified token table.- Parameters:
tokenTable
- the token table to add aliases to
-
unmodifiableSet
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.- 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
-
-