Top Fields Constructors Methods
org.eclipse.persistence.jpa.jpql.tools.model.query

public abstract Class AbstractRangeVariableDeclarationStateObject

extends AbstractStateObject
implements VariableDeclarationStateObject
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.jpql.tools.model.query.VariableDeclarationStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.model.query.DerivedPathVariableDeclarationStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.RangeVariableDeclarationStateObject
Annotations
@SuppressWarnings:nls, unused
Imports
java.io.IOException, java.util.List, org.eclipse.persistence.jpa.jpql.parser.RangeVariableDeclaration, org.eclipse.persistence.jpa.jpql.tools.model.Problem, org.eclipse.persistence.jpa.jpql.tools.utility.iterable.SingleElementListIterable, org.eclipse.persistence.jpa.jpql.utility.iterable.ListIterable

Author
Pascal Filion
Since
2.4
Version
2.5

Field Summary

Modifier and TypeField and Description
private boolean
as

Flag used to determine if the AS identifier is used or not.

public static final String
AS_PROPERTY

Notifies the visibility of the AS identifier has changed.

public static final String
IDENTIFICATION_VARIABLE_PROPERTY

Notifies the identification variable property has changed.

private IdentificationVariableStateObject
identificationVariable

The state object representing the identification variable used to reach the "root" object.

private boolean
identificationVariableOptional

Flag used to determine if the identification variable is optional or not, which is true only when this is used by UpdateClauseStateObject or by DeleteClauseStateObject.

private StateObject
rootStateObject

The state object holding the "root" for objects which may not be reachable by navigation.

Constructor Summary

AccessConstructor and Description
public
AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject
The parent of this state object, which cannot be null
parent
)

Creates a new RangeVariableDeclarationStateObject.

public
AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject
The parent of this state object, which cannot be null
parent
,
String root)

Creates a new RangeVariableDeclarationStateObject.

public
AbstractRangeVariableDeclarationStateObject(AbstractModifyClauseStateObject
The parent of this state object, which cannot be null
parent
)

Creates a new AbstractRangeVariableDeclarationStateObject.

Method Summary

Modifier and TypeMethod and Description
public AbstractRangeVariableDeclarationStateObject

Returns:

This object
addAs
()

Makes sure the AS identifier is specified.

protected void
addChildren(List<StateObject>
The list used to store the children
children
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Adds the children of this StateObject to the given list.
protected void
addProblems(List<Problem>
The list to which the problems are added
problems
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addProblems.

Adds to the given list the problems that were found with the current state of this StateObject, which means there are validation issues.
protected abstract StateObject
public RangeVariableDeclaration
getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

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

Returns:

The identification variable name
getIdentificationVariable
()

Returns the identification variable name that is ranging over the abstract schema type.

public IdentificationVariableStateObject

Returns:

The IdentificationVariableStateObject, which is never null
getIdentificationVariableStateObject
()

Returns the IdentificationVariableStateObject holding onto the identification variable.

public abstract String

Returns:

The "root" object
getRootPath
()

Returns the "root" object for objects which may not be reachable by navigation.

public StateObject

Returns:

The StateObject, which is never null
getRootStateObject
()

Returns the StateObject holding onto the abstract schema name.

public boolean

Returns:

true if the AS identifier is part of the expression; false otherwise
hasAs
()

Determines whether the AS identifier is used or not.

public boolean

Returns:

true if an identification variable is defined; false otherwise
hasIdentificationVariable
()

Determines whether an identification variable was defined.

public ListIterable<IdentificationVariableStateObject>
protected void
public boolean
isEquivalent(StateObject
The StateObject to compare its content to this one
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

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

Returns:

true if an identification variable is not required; false if it is required
isIdentificationVariableOptional
()

Determines whether the identification variable is optional or not.

public boolean

Returns:

true if this identification variable was virtually created to fully qualify path expression; false if it was parsed
isIdentificationVariableVirtual
()

Determines whether this identification variable is virtual, meaning it's not part of the query but is required for proper navigability.

public void
setAs(boolean
true if the AS identifier is part of the expression; false otherwise
as
)

Sets whether the AS identifier is used or not.

public void
setExpression(RangeVariableDeclaration
The parsed object representing a range variable declaration
expression
)

Keeps a reference of the parsed object object, which should only be* done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

public void
setIdentificationVariable(String
The new identification variable
identificationVariable
)

Sets the new identification variable that will range over the "root" object.

protected void
setIdentificationVariableOptional(boolean
true if an identification variable is not required; false if it is required
identificationVariableOptional
)

Sets whether the identification variable is optional or not.

public abstract void
setRootPath(String
The "root" object
root
)

Sets the "root" object for objects which may not be reachable by navigation.

public void
toggleAs()

Toggles the usage of the AS identifier.

protected void
toTextInternal(Appendable
The writer used to print out the string representation
writer
)

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

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.
Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject:
acceptUnknownVisitoracceptUnknownVisitoraddPropertyChangeListenerareEquivalentbuildProblembuildProblembuildStateObjectbuildStateObjectscheckParentchildrendecorateequalsfindIdentificationVariablefirePropertyChangedgetChangeSupportgetDeclarationgetDecoratorgetGrammargetManagedTypeProvidergetParentgetQueryBuildergetRootgetTypegetTypegetTypeHelpergetTypeRepositoryhashCodeisDecoratedparentparentparentremovePropertyChangeListenersetExpressionsetParenttoStringtoStringtoStringInternaltoStringItemstoText

Field Detail

asback to summary
private boolean as

Flag used to determine if the AS identifier is used or not.

AS_PROPERTYback to summary
public static final String AS_PROPERTY

Notifies the visibility of the AS identifier has changed.

IDENTIFICATION_VARIABLE_PROPERTYback to summary
public static final String IDENTIFICATION_VARIABLE_PROPERTY

Notifies the identification variable property has changed.

identificationVariableback to summary
private IdentificationVariableStateObject identificationVariable

The state object representing the identification variable used to reach the "root" object.

identificationVariableOptionalback to summary
private boolean identificationVariableOptional

Flag used to determine if the identification variable is optional or not, which is true only when this is used by UpdateClauseStateObject or by DeleteClauseStateObject.

rootStateObjectback to summary
private StateObject rootStateObject

The state object holding the "root" for objects which may not be reachable by navigation.

Constructor Detail

AbstractRangeVariableDeclarationStateObjectback to summary
public AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent)

Creates a new RangeVariableDeclarationStateObject.

Parameters
parent:AbstractIdentificationVariableDeclarationStateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
AbstractRangeVariableDeclarationStateObjectback to summary
public AbstractRangeVariableDeclarationStateObject(AbstractIdentificationVariableDeclarationStateObject parent, String root)

Creates a new RangeVariableDeclarationStateObject.

Parameters
parent:AbstractIdentificationVariableDeclarationStateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
AbstractRangeVariableDeclarationStateObjectback to summary
public AbstractRangeVariableDeclarationStateObject(AbstractModifyClauseStateObject parent)

Creates a new AbstractRangeVariableDeclarationStateObject.

Parameters
parent:AbstractModifyClauseStateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

addAsback to summary
public AbstractRangeVariableDeclarationStateObject addAs()

Makes sure the AS identifier is specified.

Returns:AbstractRangeVariableDeclarationStateObject

This object

addChildrenback to summary
protected void addChildren(List<StateObject> children)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addChildren.

Adds the children of this StateObject to the given list.

Parameters
children:List<StateObject>

The list used to store the children

Annotations
@Override
addProblemsback to summary
protected void addProblems(List<Problem> problems)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addProblems.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.addProblems.

Adds to the given list the problems that were found with the current state of this StateObject, which means there are validation issues.

Parameters
problems:List<Problem>

The list to which the problems are added

Annotations
@Override
buildRootStateObjectback to summary
protected abstract StateObject buildRootStateObject()
getExpressionback to summary
public RangeVariableDeclaration getExpression()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.getExpression.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.getExpression.

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

Returns:RangeVariableDeclaration

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)

Annotations
@Override
getIdentificationVariableback to summary
public String getIdentificationVariable()

Returns the identification variable name that is ranging over the abstract schema type.

Returns:String

The identification variable name

getIdentificationVariableStateObjectback to summary
public IdentificationVariableStateObject getIdentificationVariableStateObject()

Returns the IdentificationVariableStateObject holding onto the identification variable.

Returns:IdentificationVariableStateObject

The IdentificationVariableStateObject, which is never null

getRootPathback to summary
public abstract String getRootPath()

Returns the "root" object for objects which may not be reachable by navigation.

Returns:String

The "root" object

getRootStateObjectback to summary
public StateObject getRootStateObject()

Returns the StateObject holding onto the abstract schema name.

Returns:StateObject

The StateObject, which is never null

hasAsback to summary
public boolean hasAs()

Determines whether the AS identifier is used or not.

Returns:boolean

true if the AS identifier is part of the expression; false otherwise

hasIdentificationVariableback to summary
public boolean hasIdentificationVariable()

Determines whether an identification variable was defined.

Returns:boolean

true if an identification variable is defined; false otherwise

identificationVariablesback to summary
public ListIterable<IdentificationVariableStateObject> identificationVariables()

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.VariableDeclarationStateObject.identificationVariables.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.VariableDeclarationStateObject.identificationVariables.

Returns the IdentificationVariableStateObject that are used by this state object. It is possible more than one declaration exists, like a range variable declaration has also joins and join fetches.

Returns:ListIterable<IdentificationVariableStateObject>

The list of IdentificationVariableStateObject

Annotations
@Override
initializeback to summary
protected void initialize()

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.initialize.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.initialize.

Initializes this state object.

Annotations
@Override
isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.isEquivalent.

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject.isEquivalent.

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

Annotations
@Override
isIdentificationVariableOptionalback to summary
public boolean isIdentificationVariableOptional()

Determines whether the identification variable is optional or not. The only time it is optional is when this model is used in a modify clause (DELETE or UPDATE).

Returns:boolean

true if an identification variable is not required; false if it is required

isIdentificationVariableVirtualback to summary
public boolean isIdentificationVariableVirtual()

Determines whether this identification variable is virtual, meaning it's not part of the query but is required for proper navigability.

Returns:boolean

true if this identification variable was virtually created to fully qualify path expression; false if it was parsed

setAsback to summary
public void setAs(boolean as)

Sets whether the AS identifier is used or not.

Parameters
as:boolean

true if the AS identifier is part of the expression; false otherwise

setExpressionback to summary
public void setExpression(RangeVariableDeclaration expression)

Keeps a reference of the parsed object object, which should only be* done when this object is instantiated during the conversion of a parsed JPQL query into StateObjects.

Parameters
expression:RangeVariableDeclaration

The parsed object representing a range variable declaration

setIdentificationVariableback to summary
public void setIdentificationVariable(String identificationVariable)

Sets the new identification variable that will range over the "root" object.

Parameters
identificationVariable:String

The new identification variable

setIdentificationVariableOptionalback to summary
protected void setIdentificationVariableOptional(boolean identificationVariableOptional)

Sets whether the identification variable is optional or not. The only time it is optional is when this model is used in a modify clause (DELETE or UPDATE).

Parameters
identificationVariableOptional:boolean

true if an identification variable is not required; false if it is required

setRootPathback to summary
public abstract void setRootPath(String root)

Sets the "root" object for objects which may not be reachable by navigation.

Parameters
root:String

The "root" object

toggleAsback to summary
public void toggleAs()

Toggles the usage of the AS identifier.

toTextInternalback to summary
protected void toTextInternal(Appendable writer) throws IOException

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject.toTextInternal.

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.

Parameters
writer:Appendable

The writer used to print out the string representation

Annotations
@Override
Exceptions
IOException:
This should never happens, it is only required because Appendable is used instead of any concrete class