public class UpdateSetListMaker extends AbstractCoherenceQueryWalker
Modifier and Type | Field and Description |
---|---|
protected Object[] |
m_aoResults
The results of the classification
|
protected boolean |
m_fRValueExpected
Flag that controls the path behaviors for lvalues and rvalues.
|
protected NodeTerm |
m_term
The Term that is the AST that encodes select list
|
f_language, f_propertyBuilder, f_termKeyFunction, m_atomicTerm, m_fExtendedLanguage, m_listBindVars, m_namedBindVars, m_oResult, m_sAlias
Constructor and Description |
---|
UpdateSetListMaker(List indexedBindVars,
com.tangosol.config.expression.ParameterResolver namedBindVars,
CoherenceQueryLanguage language)
Construct a new UpdateSetListMaker using given array for indexed
Bind vars and the given Map for named bind vars.
|
Modifier and Type | Method and Description |
---|---|
protected void |
acceptBinaryOperator(String sOperator,
Term termLeft,
Term termRight)
The receiver has classified a binary operation node.
|
protected void |
acceptCall(String sFunctionName,
NodeTerm term)
The receiver has classified a call node.
|
protected void |
acceptIdentifier(String sIdentifier)
The receiver has classified an identifier node.
|
protected void |
acceptList(NodeTerm termList)
The receiver has classified a list node.
|
void |
acceptNode(String sFunctor,
NodeTerm term)
The receiver has been dispatched to from the given node.
|
protected void |
acceptPath(NodeTerm term)
The receiver has classified a path node.
|
protected void |
acceptTarget()
Do the Tree Walk for the set target AST
|
protected void |
acceptUnaryOperator(String sOperator,
Term term)
The receiver has classified a unary operation node.
|
InvocableMap.EntryProcessor |
getResultAsEntryProcessor()
Turn the results of tree processing into an InvocableMap.EntryProcessor
that will return the results of the update
|
Object[] |
getResults()
Get the resultant Object[] from the tree processing
|
protected Object |
makeListLiteral(Object[] aoArgs)
Create an ArrayList from the given arguments.
|
protected Object |
makeMapLiteral(Object[] aoArgs)
Create an Map from the given arguments.
|
Object |
makeObject(NodeTerm term)
Process the AST Tree using the given Term that that is to be turned
into an Object.
|
Object |
makeObjectForKey(NodeTerm term,
Object oValue)
Process the AST Tree using the given Term that that is to be turned
into an Object to be used as a key for the given context Object.
|
protected Object |
makePairLiteral(Object[] aoArgs)
Create an Object[] from the given arguments.
|
String |
makePathString(Object oValue)
Make a . separated String out of the given Object.
|
InvocableMap.EntryProcessor |
makeSetList()
Process the AST Tree using the already set AST Tree
|
InvocableMap.EntryProcessor |
makeSetList(NodeTerm term)
Process the AST Tree using the given Term
|
protected Object |
makeSetLiteral(Object[] aoArgs)
Create an HashSet from the given arguments.
|
protected Object |
makeSetOrMapLiteral(Object[] aoArgs)
Create a Set or Map from the given arguments.
|
ValueExtractor |
makeValueExtractor(Object oValue)
Make a ValueExtractor out of the given Object.
|
ValueUpdater |
makeValueUpdater(Object oValue)
Make a ValueUpdater out of the given Object.
|
protected boolean |
needsObjectCreation(String sFunctor,
Term term)
Test to see if we need to construct object given a node type.
|
acceptAtom, acceptIdentifierInternal, acceptKeyedBinding, acceptLiteral, acceptNumericBinding, acceptPathAsChainedExtractor, acceptTerm, append, buildExtractor, getResult, reflectiveMakeObject, setAlias, setExtendedLanguage, setResult, walk
protected NodeTerm m_term
protected Object[] m_aoResults
protected boolean m_fRValueExpected
public UpdateSetListMaker(List indexedBindVars, com.tangosol.config.expression.ParameterResolver namedBindVars, CoherenceQueryLanguage language)
indexedBindVars
- the indexed bind varsnamedBindVars
- the named bind varslanguage
- the CoherenceQueryLanguage to usepublic Object[] getResults()
public InvocableMap.EntryProcessor getResultAsEntryProcessor()
public InvocableMap.EntryProcessor makeSetList()
public InvocableMap.EntryProcessor makeSetList(NodeTerm term)
term
- the AST usedpublic Object makeObject(NodeTerm term)
term
- the AST usedRuntimeException
- Callers should catch exceptionspublic Object makeObjectForKey(NodeTerm term, Object oValue)
This situation is complicated because we try to be helpful and allow sending messages to the passed context object. Cases: new Constructor(): The Constructor can be fully qualified or not but in any case it will already be processed it's a simple call in which case it has been turned into a ReflectionExtractor so test for it and use it. identifier: This is a property and you use ValueExtractor relative to the context object derefNode that is all properties: This is a ChainedExtractor relative to the context object derefNode with calls along the way in the middle: This is a ChainedExtractor too so make it and use it on the context object literal object: These will already have been processed. The test for needsReflectiveCreation will weed this case out so you can simply return m_out. derefNode that ends in a call: We can't really tell whether it is a static call or should be a ChainedExtractor relative to the context object so we try the static call which can fail so its backed by a catch that tries again with a ChainedExtractor unless we are trying something special like .object. .
If we ever add static imports the calls will need to be checked against some Map of know static imports because the normal mechanism will make a ReflectionExtractor.
term
- the AST usedoValue
- the Object to extract results fromRuntimeException
- Callers should catch exceptionspublic void acceptNode(String sFunctor, NodeTerm term)
TermWalker
acceptNode
in interface TermWalker
acceptNode
in class AbstractCoherenceQueryWalker
sFunctor
- the node functorterm
- the NodeTermprotected void acceptList(NodeTerm termList)
AbstractCoherenceQueryWalker
acceptList
in class AbstractCoherenceQueryWalker
termList
- the Term whose children represent the elements of the listprotected void acceptIdentifier(String sIdentifier)
AbstractCoherenceQueryWalker
acceptIdentifier
in class AbstractCoherenceQueryWalker
sIdentifier
- the String representing the identifierprotected void acceptBinaryOperator(String sOperator, Term termLeft, Term termRight)
AbstractCoherenceQueryWalker
acceptBinaryOperator
in class AbstractCoherenceQueryWalker
sOperator
- the string representing the operatortermLeft
- the left Term of the operationtermRight
- the right Term of the operationprotected void acceptUnaryOperator(String sOperator, Term term)
AbstractCoherenceQueryWalker
acceptUnaryOperator
in class AbstractCoherenceQueryWalker
sOperator
- the string representing the operatorterm
- the Term being operated uponprotected void acceptCall(String sFunctionName, NodeTerm term)
AbstractCoherenceQueryWalker
acceptCall
in class AbstractCoherenceQueryWalker
sFunctionName
- the function nameterm
- a Term whose children are the parameters to the callprotected void acceptPath(NodeTerm term)
AbstractCoherenceQueryWalker
acceptPath
in class AbstractCoherenceQueryWalker
term
- a Term whose children are the elements of the pathprotected void acceptTarget()
public String makePathString(Object oValue)
oValue
- an Object or Object[] that is to be a ValueUpdaterpublic ValueUpdater makeValueUpdater(Object oValue)
oValue
- an Object or Object[] that is to be a ValueUpdaterpublic ValueExtractor makeValueExtractor(Object oValue)
oValue
- an Object or Object[] that is to be a ValueExtractorprotected boolean needsObjectCreation(String sFunctor, Term term)
sFunctor
- String representing node typeterm
- the Term that could result in Object creationprotected Object makePairLiteral(Object[] aoArgs)
aoArgs
- an array of Object to be used as a pairprotected Object makeListLiteral(Object[] aoArgs)
aoArgs
- an array of Object to be added to ArrayListprotected Object makeSetLiteral(Object[] aoArgs)
aoArgs
- an array of Object to be added to ArrayListprotected Object makeSetOrMapLiteral(Object[] aoArgs)
aoArgs
- an array of Object to be added to ArrayList