Package com.tangosol.coherence.dslquery
Class FilterBuilder
java.lang.Object
com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
com.tangosol.coherence.dslquery.FilterBuilder
- All Implemented Interfaces:
TermWalker
public class FilterBuilder
extends com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
FilterBuilder is a visitor class that converts a given Abstract Syntax
Tree into a Filter. The Filter can be a deep nesting of Filters.
- Author:
- djl 2009.08.31, jk 2013.12.02
-
Field Summary
Modifier and TypeFieldDescriptionprotected final ParameterResolver
The default named bind variables.protected final List
The default indexed bind variables.protected String
The cache name this FilterBuilder is buildingFilter
s to query against.protected Term
The Term that is the AST that encodes the Filter to be made.Fields inherited from class com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
f_language, f_propertyBuilder, f_termKeyFunction, m_atomicTerm, m_fExtendedLanguage, m_listBindVars, m_namedBindVars, m_oResult, m_sAlias
-
Constructor Summary
ConstructorDescriptionConstruct a new FilterBuilder.FilterBuilder
(CoherenceQueryLanguage language) Construct a new FilterBuilder.FilterBuilder
(Term term) Construct a new FilterBuilder that can construct a Filter from the given Term.FilterBuilder
(Object[] aoBindVars) Construct a new FilterBuilder with given binding environment.FilterBuilder
(Object[] aoBindVars, Map mapNamedBindVars) Construct a new FilterBuilder with given binding environment.FilterBuilder
(List indexedBindVars, ParameterResolver namedBindVars, CoherenceQueryLanguage language) Construct a new FilterBuilder with given default bind variables. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
acceptBinaryOperator
(String sOperator, Term termLeft, Term termRight) This method will take a Binary Operator and the left and rightTerm
s for the operator and result in the creation of aFilter
or aValueExtractor
.protected void
acceptIdentifier
(String sIdentifier) The receiver has classified an identifier node.protected void
acceptList
(NodeTerm termList) The receiver has classified a list node.protected void
acceptPath
(NodeTerm term) The receiver has classified a path node.protected void
acceptUnaryOperator
(String sOperator, Term t) The receiver has classified a unary operation node.makeExtractor
(NodeTerm term) Process the AST Tree using the given Term that represents getter.Make a new Filter from the set AST.makeFilter
(Term term) Make a new Filter from the given AST.makeFilter
(Term term, Object[] aoIndexedBindVars) Make a new Filter from the given AST using given array for Bind vars.makeFilter
(Term term, Object[] aoIndexedBindVars, Map mapNamedBindVars) Make a new Filter from the given AST using the given bind variables.makeFilter
(Term term, List listBindVars, ParameterResolver namedBindVars) Make a new Filter from the given AST using the given bind variables.makeFilterForCache
(String sCacheName, Term term, List indexedBindVars, ParameterResolver namedBindVars) Make a new Filter from the given AST using given array for Bind vars.protected static ParameterList
newParameterListFromMap
(Map<?, ?> map) Convert the givenMap
into aParameterList
.Methods inherited from class com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
acceptAtom, acceptCall, acceptIdentifierInternal, acceptKeyedBinding, acceptLiteral, acceptNode, acceptNumericBinding, acceptPathAsChainedExtractor, acceptTerm, append, buildExtractor, getResult, reflectiveMakeObject, setAlias, setExtendedLanguage, setResult, walk
-
Field Details
-
m_term
The Term that is the AST that encodes the Filter to be made. -
m_sCacheName
The cache name this FilterBuilder is buildingFilter
s to query against.This is used by the
language's
ExtractorBuilder
to map attribute names to POF indices. A null cache name results in the use ofReflectionExtractor
s. -
f_listDefaultBindVars
The default indexed bind variables. -
f_defaultNamedBindVars
The default named bind variables.
-
-
Constructor Details
-
FilterBuilder
public FilterBuilder()Construct a new FilterBuilder. -
FilterBuilder
Construct a new FilterBuilder.- Parameters:
language
- theCoherenceQueryLanguage
instance to use
-
FilterBuilder
Construct a new FilterBuilder with given binding environment.- Parameters:
aoBindVars
- an Object array of indexed bind variables
-
FilterBuilder
Construct a new FilterBuilder that can construct a Filter from the given Term.- Parameters:
term
- the Term to use in the construction of a filter
-
FilterBuilder
Construct a new FilterBuilder with given binding environment.- Parameters:
aoBindVars
- indexed bind variablesmapNamedBindVars
- named bind variables
-
FilterBuilder
public FilterBuilder(List indexedBindVars, ParameterResolver namedBindVars, CoherenceQueryLanguage language) Construct a new FilterBuilder with given default bind variables.- Parameters:
indexedBindVars
- the indexed bind variablesnamedBindVars
- the named bind variableslanguage
- theCoherenceQueryLanguage
instance to use
-
-
Method Details
-
makeFilter
Make a new Filter from the set AST.- Returns:
- the constructed Filter
-
makeFilter
Make a new Filter from the given AST.- Parameters:
term
- the AST to turn into a Filter- Returns:
- the constructed Filter
-
makeFilter
Make a new Filter from the given AST using given array for Bind vars.- Parameters:
term
- the AST to turn into a FilteraoIndexedBindVars
- the array of Objects to use for Bind vars- Returns:
- the constructed Filter
-
makeFilter
Make a new Filter from the given AST using the given bind variables.- Parameters:
term
- the AST to turn into a FilteraoIndexedBindVars
- the array of Objects to use for bind variablesmapNamedBindVars
- the named bind variables to use- Returns:
- the constructed Filter
-
makeFilter
Make a new Filter from the given AST using the given bind variables.- Parameters:
term
- the AST to turn into a FilterlistBindVars
- the indexed bind variablesnamedBindVars
- the named bind variables- Returns:
- the constructed Filter
-
makeFilterForCache
public Filter makeFilterForCache(String sCacheName, Term term, List indexedBindVars, ParameterResolver namedBindVars) Make a new Filter from the given AST using given array for Bind vars.- Parameters:
sCacheName
- the name of the cache the Filter is to queryterm
- the AST to turn into a FilterindexedBindVars
- the indexed bind variables to usenamedBindVars
- the named bind variables to use- Returns:
- the constructed Filter
-
makeExtractor
Process the AST Tree using the given Term that represents getter.- Parameters:
term
- the AST used- Returns:
- the resulting ValueExtractor
-
acceptList
Description copied from class:com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
The receiver has classified a list node.- Overrides:
acceptList
in classcom.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
- Parameters:
termList
- the Term whose children represent the elements of the list
-
acceptIdentifier
Description copied from class:com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
The receiver has classified an identifier node.- Overrides:
acceptIdentifier
in classcom.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
- Parameters:
sIdentifier
- the String representing the identifier
-
acceptBinaryOperator
This method will take a Binary Operator and the left and rightTerm
s for the operator and result in the creation of aFilter
or aValueExtractor
.- Overrides:
acceptBinaryOperator
in classcom.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
- Parameters:
sOperator
- the string representing the operatortermLeft
- the left Term of the operationtermRight
- the right Term of the operation
-
acceptUnaryOperator
Description copied from class:com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
The receiver has classified a unary operation node.- Overrides:
acceptUnaryOperator
in classcom.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
- Parameters:
sOperator
- the string representing the operatort
- the Term being operated upon
-
acceptPath
Description copied from class:com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
The receiver has classified a path node.- Overrides:
acceptPath
in classcom.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
- Parameters:
term
- a Term whose children are the elements of the path
-
newParameterListFromMap
Convert the givenMap
into aParameterList
. The key of the map is used as the parameter name and the corresponding value as the parameter value.- Parameters:
map
- the Map to convert to a ParameterList- Returns:
- a ParameterList made up of the contents of the specified Map
-