Interface Query


  • public interface Query
    Queries are wrapping filters and are assembled in a query tree. Each query is built from a single filter instance and it's role is to basically to execute the filter. The graph that is passed to the filter depends on the fact the query belongs to a complex query tree or if the tree is a single leaf.

    The system works like this. Leaves of the query tree receives the complete graph and the subgraphs they return are passed to the parent query. Thus the root query is the last query to get the subgraphs and returns the final result. This querying system make possible to create query chains and complex scenario with various operators (AND, OR, ...).

    Queries are built by the FilterController from filter instances.

    Author:
    Mathieu Bastian
    See Also:
    FilterController
    • Method Detail

      • getName

        String getName()
        Returns query's full name.
        Returns:
        query's name
      • setName

        void setName​(String name)
        Sets the query name to a custom value
        Parameters:
        name - Custom name
      • getChildren

        Query[] getChildren()
        Returns queries that are children of this query.
        Returns:
        query's children
      • getChildrenSlotsCount

        int getChildrenSlotsCount()
        Returns the limit number of children this query can have. Return 1 for a standard query.
        Returns:
        the number of allowed children query
      • getParent

        Query getParent()
        Returns the parent query or null if this query is root.
        Returns:
        the query's parent query, or null
      • getPropertiesCount

        int getPropertiesCount()
        Returns the number of properties this query has.
        Returns:
        the query's number of properties
      • getPropertyName

        String getPropertyName​(int index)
        Returns the name of the property at the specified index.
        Parameters:
        index - the index of the property
        Returns:
        the query's property name
        Throws:
        ArrayIndexOutOfBoundsException - if index is out of bounds
      • getPropertyValue

        Object getPropertyValue​(int index)
        Returns the value of the property at the specified index.
        Parameters:
        index - the index of the property
        Returns:
        the query's property value
        Throws:
        ArrayIndexOutOfBoundsException - if index is out of bounds
      • getQueries

        Query[] getQueries​(Class<? extends Filter> filterClass)
        Utility method that returns all queries in this query hierarchy that are filterClass instance.
        Parameters:
        filterClass - the filter class that is to be queried
        Returns:
        all queries, including self that are filterClass instance
      • getDescendantsAndSelf

        Query[] getDescendantsAndSelf()
        Utility method that returns all descendant queries plus this query.
        Returns:
        all descendant queries and self
      • getFilter

        Filter getFilter()
        Returns the filter this query is wrapping.
        Returns:
        the filter
      • getBuilder

        FilterBuilder getBuilder()
        Returns the filter builder that creates the filter this query is wrapping.
        Returns:
        the builder or null