Class 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 Detail

      • m_term

        protected Term m_term
        The Term that is the AST that encodes the Filter to be made.
      • f_listDefaultBindVars

        protected final List f_listDefaultBindVars
        The default indexed bind variables.
      • f_defaultNamedBindVars

        protected final ParameterResolver f_defaultNamedBindVars
        The default named bind variables.
    • Constructor Detail

      • FilterBuilder

        public FilterBuilder()
        Construct a new FilterBuilder.
      • FilterBuilder

        public FilterBuilder​(Object[] aoBindVars)
        Construct a new FilterBuilder with given binding environment.
        Parameters:
        aoBindVars - an Object array of indexed bind variables
      • FilterBuilder

        public FilterBuilder​(Term term)
        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

        public FilterBuilder​(Object[] aoBindVars,
                             Map mapNamedBindVars)
        Construct a new FilterBuilder with given binding environment.
        Parameters:
        aoBindVars - indexed bind variables
        mapNamedBindVars - 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 variables
        namedBindVars - the named bind variables
        language - the CoherenceQueryLanguage instance to use
    • Method Detail

      • makeFilter

        public Filter makeFilter()
        Make a new Filter from the set AST.
        Returns:
        the constructed Filter
      • makeFilter

        public Filter makeFilter​(Term term)
        Make a new Filter from the given AST.
        Parameters:
        term - the AST to turn into a Filter
        Returns:
        the constructed Filter
      • makeFilter

        public Filter makeFilter​(Term term,
                                 Object[] aoIndexedBindVars)
        Make a new Filter from the given AST using given array for Bind vars.
        Parameters:
        term - the AST to turn into a Filter
        aoIndexedBindVars - the array of Objects to use for Bind vars
        Returns:
        the constructed Filter
      • makeFilter

        public Filter makeFilter​(Term term,
                                 Object[] aoIndexedBindVars,
                                 Map mapNamedBindVars)
        Make a new Filter from the given AST using the given bind variables.
        Parameters:
        term - the AST to turn into a Filter
        aoIndexedBindVars - the array of Objects to use for bind variables
        mapNamedBindVars - the named bind variables to use
        Returns:
        the constructed Filter
      • makeFilter

        public Filter makeFilter​(Term term,
                                 List listBindVars,
                                 ParameterResolver namedBindVars)
        Make a new Filter from the given AST using the given bind variables.
        Parameters:
        term - the AST to turn into a Filter
        listBindVars - the indexed bind variables
        namedBindVars - 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 query
        term - the AST to turn into a Filter
        indexedBindVars - the indexed bind variables to use
        namedBindVars - the named bind variables to use
        Returns:
        the constructed Filter
      • makeExtractor

        public ValueExtractor makeExtractor​(NodeTerm term)
        Process the AST Tree using the given Term that represents getter.
        Parameters:
        term - the AST used
        Returns:
        the resulting ValueExtractor
      • acceptList

        protected void acceptList​(NodeTerm termList)
        Description copied from class: com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
        The receiver has classified a list node.
        Overrides:
        acceptList in class com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
        Parameters:
        termList - the Term whose children represent the elements of the list
      • acceptIdentifier

        protected void acceptIdentifier​(String sIdentifier)
        Description copied from class: com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
        The receiver has classified an identifier node.
        Overrides:
        acceptIdentifier in class com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
        Parameters:
        sIdentifier - the String representing the identifier
      • acceptBinaryOperator

        protected void acceptBinaryOperator​(String sOperator,
                                            Term termLeft,
                                            Term termRight)
        This method will take a Binary Operator and the left and right Terms for the operator and result in the creation of a Filter or a ValueExtractor.
        Overrides:
        acceptBinaryOperator in class com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
        Parameters:
        sOperator - the string representing the operator
        termLeft - the left Term of the operation
        termRight - the right Term of the operation
      • acceptUnaryOperator

        protected void acceptUnaryOperator​(String sOperator,
                                           Term t)
        Description copied from class: com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
        The receiver has classified a unary operation node.
        Overrides:
        acceptUnaryOperator in class com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
        Parameters:
        sOperator - the string representing the operator
        t - the Term being operated upon
      • acceptPath

        protected void acceptPath​(NodeTerm term)
        Description copied from class: com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
        The receiver has classified a path node.
        Overrides:
        acceptPath in class com.tangosol.coherence.dslquery.internal.AbstractCoherenceQueryWalker
        Parameters:
        term - a Term whose children are the elements of the path
      • newParameterListFromMap

        protected static ParameterList newParameterListFromMap​(Map<?,​?> map)
        Convert the given Map into a ParameterList. 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