Top Description Methods
org.eclipse.persistence.jpa.jpql.tools.model.query

public Interface StateObject

Known Direct Subinterfaces
org.eclipse.persistence.jpa.jpql.tools.model.query.VariableDeclarationStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.DeclarationStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject
Known Direct Implementers
org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject
Imports
org.eclipse.persistence.jpa.jpql.parser.Expression, .JPQLGrammar, org.eclipse.persistence.jpa.jpql.tools.model.IJPQLQueryBuilder, .IPropertyChangeListener, org.eclipse.persistence.jpa.jpql.tools.spi.IManagedTypeProvider

A StateObject is an editable representation of a JPQL query.

IJPQLQueryBuilder can be used to create the state model from an existing JPQL query.

Author
Pascal Filion
Since
2.4
Version
2.5

Method Summary

Modifier and TypeMethod and Description
public void
accept(StateObjectVisitor
The visitor to visit this object
visitor
)

Visits this StateObject by the given visitor.

public void
addPropertyChangeListener(String
The name of the property for which the listener was registered
propertyName
,
IPropertyChangeListener<?>
The listener to be notified upon changes
listener
)

Registers the given IPropertyChangeListener for the specified property.

public Iterable<StateObject>

Returns:

The children of this StateObject or an empty iterable this state object does not have children
children
()

Returns the ordered children of this StateObject.

public void
decorate(StateObject
The StateObject decorating this one
decorator
)

Decorates this StateObject with the given decorator.

public IdentificationVariableStateObject

Returns:

The IdentificationVariableStateObject defining the given identification variable
findIdentificationVariable
(String
The name of the identification variable to retrieve its state object
identificationVariable
)

Returns the IdentificationVariableStateObject representing the given identification variable.

public DeclarationStateObject

Returns:

The declaration clause of which this StateObject is a child; i.e. either the top-level declaration if this is part of the top query or the sub-level declaration if this is part of a subquery
getDeclaration
()

Returns the declaration clause which defines the domain of the query by declaring identification variables.

public StateObject

Returns:

The StateObject decorating this one
getDecorator
()

Returns the StateObject decorating this one if one has been set, which means the behavior of this StateObject is modified by the decorator.

public Expression

Returns:

The parsed object when a JPQL query is parsed and converted into a StateObject or null when the JPQL query is manually created (i.e. not from a string)
getExpression
()

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.

public JPQLGrammar

Returns:

The grammar that was used to parse the JPQL query
getGrammar
()

Returns the grammar that defines how to parse a JPQL query.

public IManagedTypeProvider

Returns:

The provider that gives access to the managed types
getManagedTypeProvider
()

Returns the provider of managed types.

public StateObject

Returns:

Returns the parent of this StateObject, which is null only when this is the root of the hierarchy
getParent
()

Returns the parent of this StateObject.

public IJPQLQueryBuilder

Returns:

The builder that created this StateObject from a JPQL query or that gives access to various sub-builders
getQueryBuilder
()

Returns the IJPQLQueryBuilder that is responsible to create various part of the StateObject hierarchy.

public JPQLQueryStateObject

Returns:

The root of the state model representing the JPQL query
getRoot
()

Returns the root of the StateObject hierarchy.

public boolean
isDecorated()

Determines whether this StateObject is being decorated by another StateObject, which means the behavior is modified by the given one.

public boolean

Returns:

true if both object are equivalent; false otherwise
isEquivalent
(StateObject
The StateObject to compare its content to this one
stateObject
)

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.

public void
removePropertyChangeListener(String
The name of the property for which the listener was registered
propertyName
,
IPropertyChangeListener<?>
The listener to unregister
listener
)

Unregisters the given IPropertyChangeListener that was registered for the specified property.

public void
setParent(StateObject
The new parent StateObject of this one, which cannot be null
parent
)

Sets the given StateObject to become the parent of this one.

public void
toString(Appendable
The writer used to print out the string representation
writer
)

Prints out a string representation of this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.

public void
toText(Appendable
The writer used to print out the string representation
writer
)

Prints out a string representation of this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.

Method Detail

acceptback to summary
public void accept(StateObjectVisitor visitor)

Visits this StateObject by the given visitor.

Parameters
visitor:StateObjectVisitor

The visitor to visit this object

addPropertyChangeListenerback to summary
public void addPropertyChangeListener(String propertyName, IPropertyChangeListener<?> listener)

Registers the given IPropertyChangeListener for the specified property. The listener will be notified only for changes to the specified property.

Parameters
propertyName:String

The name of the property for which the listener was registered

listener:IPropertyChangeListener<?>

The listener to be notified upon changes

Exceptions
NullPointerException:
IPropertyChangeListener cannot be null
IllegalArgumentException:
The listener is already registered with the property name
childrenback to summary
public Iterable<StateObject> children()

Returns the ordered children of this StateObject.

Returns:Iterable<StateObject>

The children of this StateObject or an empty iterable this state object does not have children

decorateback to summary
public void decorate(StateObject decorator)

Decorates this StateObject with the given decorator. It means the behavior of this StateObject is modified by the given one. By default, this StateObject becomes the parent of the given one.

Parameters
decorator:StateObject

The StateObject decorating this one

findIdentificationVariableback to summary
public IdentificationVariableStateObject findIdentificationVariable(String identificationVariable)

Returns the IdentificationVariableStateObject representing the given identification variable.

Parameters
identificationVariable:String

The name of the identification variable to retrieve its state object

Returns:IdentificationVariableStateObject

The IdentificationVariableStateObject defining the given identification variable

getDeclarationback to summary
public DeclarationStateObject getDeclaration()

Returns the declaration clause which defines the domain of the query by declaring identification variables.

Returns:DeclarationStateObject

The declaration clause of which this StateObject is a child; i.e. either the top-level declaration if this is part of the top query or the sub-level declaration if this is part of a subquery

getDecoratorback to summary
public StateObject getDecorator()

Returns the StateObject decorating this one if one has been set, which means the behavior of this StateObject is modified by the decorator.

Returns:StateObject

The StateObject decorating this one

getExpressionback to summary
public Expression getExpression()

Returns the actual parsed object if this StateObject representation of the JPQL query was created by parsing an existing JPQL query.

Returns:Expression

The parsed object when a JPQL query is parsed and converted into a StateObject or null when the JPQL query is manually created (i.e. not from a string)

getGrammarback to summary
public JPQLGrammar getGrammar()

Returns the grammar that defines how to parse a JPQL query.

Returns:JPQLGrammar

The grammar that was used to parse the JPQL query

getManagedTypeProviderback to summary
public IManagedTypeProvider getManagedTypeProvider()

Returns the provider of managed types.

Returns:IManagedTypeProvider

The provider that gives access to the managed types

getParentback to summary
public StateObject getParent()

Returns the parent of this StateObject.

Returns:StateObject

Returns the parent of this StateObject, which is null only when this is the root of the hierarchy

getQueryBuilderback to summary
public IJPQLQueryBuilder getQueryBuilder()

Returns the IJPQLQueryBuilder that is responsible to create various part of the StateObject hierarchy.

Returns:IJPQLQueryBuilder

The builder that created this StateObject from a JPQL query or that gives access to various sub-builders

getRootback to summary
public JPQLQueryStateObject getRoot()

Returns the root of the StateObject hierarchy.

Returns:JPQLQueryStateObject

The root of the state model representing the JPQL query

isDecoratedback to summary
public boolean isDecorated()

Determines whether this StateObject is being decorated by another StateObject, which means the behavior is modified by the given one. return true if this StateObject is being decorated; false otherwise

isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Determines whether the given StateObject is equivalent to this one, i.e. the information of both StateObject is the same.

Parameters
stateObject:StateObject

The StateObject to compare its content to this one

Returns:boolean

true if both object are equivalent; false otherwise

removePropertyChangeListenerback to summary
public void removePropertyChangeListener(String propertyName, IPropertyChangeListener<?> listener)

Unregisters the given IPropertyChangeListener that was registered for the specified property. The listener will no longer be notified when the property changes.

Parameters
propertyName:String

The name of the property for which the listener was registered

listener:IPropertyChangeListener<?>

The listener to unregister

Exceptions
NullPointerException:
IPropertyChangeListener cannot be null
IllegalArgumentException:
The listener was never registered with the property name
setParentback to summary
public void setParent(StateObject parent)

Sets the given StateObject to become the parent of this one.

Parameters
parent:StateObject

The new parent StateObject of this one, which cannot be null

toStringback to summary
public void toString(Appendable writer)

Prints out a string representation of this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.

Important Note

If this StateObject is decorated by another one, then toText(Appendable) from that decorator is invoked, otherwise the information contained in this one will be printed out.

Parameters
writer:Appendable

The writer used to print out the string representation

See Also
toText(Appendable)
toTextback to summary
public void toText(Appendable writer)

Prints out a string representation of this StateObject, which should not be used to define a true string representation of a JPQL query but should be used for debugging purposes.

Important Note

Even if this StateObject is decorated by another one, the decorator will not be used to print out a string representation of this one.

Parameters
writer:Appendable

The writer used to print out the string representation

See Also
toString(Appendable)