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

public Class IdentificationVariableStateObject

extends SimpleStateObject
Class Inheritance
Annotations
@SuppressWarnings:nls
Imports
java.io.IOException, java.util.List, org.eclipse.persistence.jpa.jpql.ExpressionTools, org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable, org.eclipse.persistence.jpa.jpql.tools.model.Problem, org.eclipse.persistence.jpa.jpql.tools.spi.IManagedType, .IMapping, .IType, .ITypeDeclaration

This state object represents a single identification variable, which is identifying TODO.
Author
Pascal Filion
Since
2.4
Version
2.4
See Also
IdentificationVariable

Field Summary

Modifier and TypeField and Description
public static final String
DEFINED_PROPERTY

Notify a change in the defined property.

private IManagedType
managedType

The IManagedType mapped to the identification variable if the identification variable maps to an entity name.

private IMapping
private IType
type

The IType of the object being mapped to this identification variable.

private ITypeDeclaration
typeDeclaration

The ITypeDeclaration of the object being mapped to this identification variable.

private boolean
virtual

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

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject:
TEXT_PROPERTY

Constructor Summary

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

Creates a new IdentificationVariableStateObject.

public
IdentificationVariableStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
The name of the identification variable
variable
)

Creates a new IdentificationVariableStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
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 void
checkIntegrity(String
The new identification variable
text
)

Makes sure the current identification variable and the given one are the same.

protected void
clearResolvedObjects()

Clears the values related to the managed type and type.

public IdentificationVariable
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 IManagedType

Returns:

Either the IManagedType, if it could be resolved; null otherwise
getManagedType
()

Returns the IManagedType associated with the field handled by this object.

public IMapping
getMapping()

Returns

public IType

Returns:

Either the IType that was resolved by this state object or the IType for IType#UNRESOLVABLE_TYPE if it could not be resolved
getType
()

Returns the IType of the field handled by this object.

public ITypeDeclaration

Returns:

Either the ITypeDeclaration that was resolved by this object or the ITypeDeclaration for IType#UNRESOLVABLE_TYPE if it could not be resolved
getTypeDeclaration
()

Returns the ITypeDeclaration of the field handled by this object.

public boolean
isEquivalent(StateObject
The StateObject to compare its content to this one
stateObject
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject.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 this identification variable was virtually created to fully qualify path expression; false if it was parsed
isVirtual
()

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

protected IManagedType

Returns:

Either the IManagedType declared by the identification variable or null if it could not be resolved
resolveManagedType
()

Retrieves the IManagedType that is mapped to the identification variable, if and only if the identification variable is used to declare an entity.

protected IMapping
resolveMapping()

Resolves

protected IType

Returns:

Either the IType that was resolved by this object or the IType for IType#UNRESOLVABLE_TYPE if it could not be resolved
resolveType
()

Resolves the IType of the property handled by this object.

protected ITypeDeclaration

Returns:

Either the ITypeDeclaration that was resolved by this object or the ITypeDeclaration for IType#UNRESOLVABLE_TYPE if it could not be resolved
resolveTypeDeclaration
()

Resolves the ITypeDeclaration of the property handled by this object.

public void
setExpression(IdentificationVariable
The parsed object representing an identification variable
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
setText(String
This model's text value
text
)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject.setText.

Sets the text held by this state object.
public void
setVirtual(boolean
true if this identification variable was virtually created to fully qualify path expression; false if it was parsed
virtual
)

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

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

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject.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.SimpleStateObject:
getTexthasTextsetTextInternally

Field Detail

DEFINED_PROPERTYback to summary
public static final String DEFINED_PROPERTY

Notify a change in the defined property.

managedTypeback to summary
private IManagedType managedType

The IManagedType mapped to the identification variable if the identification variable maps to an entity name.

mappingback to summary
private IMapping mapping
typeback to summary
private IType type

The IType of the object being mapped to this identification variable.

typeDeclarationback to summary
private ITypeDeclaration typeDeclaration

The ITypeDeclaration of the object being mapped to this identification variable.

virtualback to summary
private boolean virtual

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

Constructor Detail

IdentificationVariableStateObjectback to summary
public IdentificationVariableStateObject(StateObject parent)

Creates a new IdentificationVariableStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
IdentificationVariableStateObjectback to summary
public IdentificationVariableStateObject(StateObject parent, String variable)

Creates a new IdentificationVariableStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

variable:String

The name of the identification variable

Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

acceptback to summary
public void accept(StateObjectVisitor visitor)

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

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

Visits this StateObject by the given visitor.

Parameters
visitor:StateObjectVisitor

The visitor to visit this object

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
checkIntegrityback to summary
protected void checkIntegrity(String text)

Makes sure the current identification variable and the given one are the same. If they are not, then clears the cached values related to the type.

Parameters
text:String

The new identification variable

clearResolvedObjectsback to summary
protected void clearResolvedObjects()

Clears the values related to the managed type and type.

getExpressionback to summary
public IdentificationVariable 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:IdentificationVariable

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
getManagedTypeback to summary
public IManagedType getManagedType()

Returns the IManagedType associated with the field handled by this object. If this object does not handle a field that has a IManagedType, then null should be returned.

For example: "SELECT e FROM Employee e", the object for e would be returning the IManagedType for Employee.

Returns:IManagedType

Either the IManagedType, if it could be resolved; null otherwise

getMappingback to summary
public IMapping getMapping()

Returns

getTypeback to summary
public IType getType()

Returns the IType of the field handled by this object.

Returns:IType

Either the IType that was resolved by this state object or the IType for IType#UNRESOLVABLE_TYPE if it could not be resolved

getTypeDeclarationback to summary
public ITypeDeclaration getTypeDeclaration()

Returns the ITypeDeclaration of the field handled by this object.

Returns:ITypeDeclaration

Either the ITypeDeclaration that was resolved by this object or the ITypeDeclaration for IType#UNRESOLVABLE_TYPE if it could not be resolved

isEquivalentback to summary
public boolean isEquivalent(StateObject stateObject)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject.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
isVirtualback to summary
public boolean isVirtual()

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

resolveManagedTypeback to summary
protected IManagedType resolveManagedType()

Retrieves the IManagedType that is mapped to the identification variable, if and only if the identification variable is used to declare an entity.

Returns:IManagedType

Either the IManagedType declared by the identification variable or null if it could not be resolved

resolveMappingback to summary
protected IMapping resolveMapping()

Resolves

resolveTypeback to summary
protected IType resolveType()

Resolves the IType of the property handled by this object.

Returns:IType

Either the IType that was resolved by this object or the IType for IType#UNRESOLVABLE_TYPE if it could not be resolved

resolveTypeDeclarationback to summary
protected ITypeDeclaration resolveTypeDeclaration()

Resolves the ITypeDeclaration of the property handled by this object.

Returns:ITypeDeclaration

Either the ITypeDeclaration that was resolved by this object or the ITypeDeclaration for IType#UNRESOLVABLE_TYPE if it could not be resolved

setExpressionback to summary
public void setExpression(IdentificationVariable 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:IdentificationVariable

The parsed object representing an identification variable

setTextback to summary
public void setText(String text)

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject.setText.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject.setText.

Sets the text held by this state object.

Parameters
text:String

This model's text value

Annotations
@Override
setVirtualback to summary
public void setVirtual(boolean virtual)

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

Parameters
virtual:boolean

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

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

Overrides org.eclipse.persistence.jpa.jpql.tools.model.query.SimpleStateObject.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