org.modeshape.graph.query
Class QueryContext

java.lang.Object
  extended by org.modeshape.graph.query.QueryContext
Direct Known Subclasses:
Graph.GraphQueryContext

@Immutable
public class QueryContext
extends Object

An immutable context in which queries are to be executed. Each query context defines the information that is available during query execution.


Constructor Summary
protected QueryContext(QueryContext original)
          Create a new context that is a copy of the supplied context.
  QueryContext(Schemata schemata, TypeSystem typeSystem)
          Create a new context for query execution.
  QueryContext(Schemata schemata, TypeSystem typeSystem, PlanHints hints)
          Create a new context for query execution.
  QueryContext(Schemata schemata, TypeSystem typeSystem, PlanHints hints, Problems problems)
          Create a new context for query execution.
  QueryContext(Schemata schemata, TypeSystem typeSystem, PlanHints hints, Problems problems, Map<String,Object> variables)
          Create a new context for query execution.
 
Method Summary
 boolean equals(Object obj)
          
 PlanHints getHints()
          Get the plan hints.
 Problems getProblems()
          Get the problem container used by this query context.
 Schemata getSchemata()
          Get the definition of the tables available within this query context.
 TypeSystem getTypeSystem()
          Get the interface for working with literal values and types.
 Map<String,Object> getVariables()
          Get the variables that are to be substituted into the BindVariableName used in the query.
 QueryContext with(Map<String,Object> variables)
          Obtain a copy of this context, except that the copy uses the supplied variables.
 QueryContext with(PlanHints hints)
          Obtain a copy of this context, except that the copy uses the supplied hints.
 QueryContext with(Problems problems)
          Obtain a copy of this context, except that the copy uses the supplied problem container.
 QueryContext with(Schemata schemata)
          Obtain a copy of this context, except that the copy uses the supplied schemata.
 QueryContext with(TypeSystem typeSystem)
          Obtain a copy of this context, except that the copy uses the supplied type system.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QueryContext

public QueryContext(Schemata schemata,
                    TypeSystem typeSystem,
                    PlanHints hints,
                    Problems problems,
                    Map<String,Object> variables)
Create a new context for query execution.

Parameters:
schemata - the schemata
typeSystem - the types system
hints - the hints, or null if there are no hints
problems - the problems container, or null if a new problems container should be created
variables - the mapping of variables and values, or null if there are no such variables
Throws:
IllegalArgumentException - if the values or schmata are null

QueryContext

public QueryContext(Schemata schemata,
                    TypeSystem typeSystem,
                    PlanHints hints,
                    Problems problems)
Create a new context for query execution.

Parameters:
schemata - the schemata
typeSystem - the types system
hints - the hints, or null if there are no hints
problems - the problems container, or null if a new problems container should be created
Throws:
IllegalArgumentException - if the values or schmata are null

QueryContext

public QueryContext(Schemata schemata,
                    TypeSystem typeSystem,
                    PlanHints hints)
Create a new context for query execution.

Parameters:
schemata - the schemata
typeSystem - the types system
hints - the hints, or null if there are no hints
Throws:
IllegalArgumentException - if the context or schmata are null

QueryContext

public QueryContext(Schemata schemata,
                    TypeSystem typeSystem)
Create a new context for query execution.

Parameters:
schemata - the schemata
typeSystem - the types system
Throws:
IllegalArgumentException - if the values or schmata are null

QueryContext

protected QueryContext(QueryContext original)
Create a new context that is a copy of the supplied context. This constructor is useful for subclasses that wish to add store additional fields in a QueryContext.

Parameters:
original - the original context
Throws:
IllegalArgumentException - if the original is null
Method Detail

getTypeSystem

public TypeSystem getTypeSystem()
Get the interface for working with literal values and types.

Returns:
the type system; never null

getHints

public final PlanHints getHints()
Get the plan hints.

Returns:
the plan hints; never null

getProblems

public final Problems getProblems()
Get the problem container used by this query context. Any problems that have been encountered will be accumlated in this container.

Returns:
the problem container; never null

getSchemata

public Schemata getSchemata()
Get the definition of the tables available within this query context.

Returns:
the schemata; never null

getVariables

public Map<String,Object> getVariables()
Get the variables that are to be substituted into the BindVariableName used in the query.

Returns:
immutable map of variable values keyed by their name; never null but possibly empty

equals

public boolean equals(Object obj)

Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

with

public QueryContext with(TypeSystem typeSystem)
Obtain a copy of this context, except that the copy uses the supplied type system.

Parameters:
typeSystem - the type system that should be used in the new query context
Returns:
the new context; never null
Throws:
IllegalArgumentException - if the execution context reference is null

with

public QueryContext with(Schemata schemata)
Obtain a copy of this context, except that the copy uses the supplied schemata.

Parameters:
schemata - the schemata that should be used in the new context
Returns:
the new context; never null
Throws:
IllegalArgumentException - if the schemata reference is null

with

public QueryContext with(PlanHints hints)
Obtain a copy of this context, except that the copy uses the supplied hints.

Parameters:
hints - the hints that should be used in the new context
Returns:
the new context; never null
Throws:
IllegalArgumentException - if the hints reference is null

with

public QueryContext with(Problems problems)
Obtain a copy of this context, except that the copy uses the supplied problem container.

Parameters:
problems - the problems that should be used in the new context; may be null if a new problem container should be used
Returns:
the new context; never null

with

public QueryContext with(Map<String,Object> variables)
Obtain a copy of this context, except that the copy uses the supplied variables.

Parameters:
variables - the variables that should be used in the new context; may be null if there are no such variables
Returns:
the new context; never null


Copyright © 2008-2010 JBoss, a division of Red Hat. All Rights Reserved.