public abstract class AbstractPathExpressionStateObject extends AbstractStateObject implements ListHolderStateObject<java.lang.String>
AbstractPathExpression| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
IDENTIFICATION_VARIABLE_PROPERTY
Notifies the identification variable property has changed.
|
static java.lang.String |
PATHS_LIST
Notifies the content of the paths list has changed.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPathExpressionStateObject(StateObject parent)
Creates a new
AbstractPathExpressionStateObject. |
protected |
AbstractPathExpressionStateObject(StateObject parent,
java.lang.String path)
Creates a new
AbstractPathExpressionStateObject. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addChildren(java.util.List<StateObject> children)
Adds the children of this
StateObject to the given list. |
java.lang.String |
addItem(java.lang.String item)
Adds the given
StateObject as a child of this one. |
void |
addItems(java.util.List<? extends java.lang.String> items)
Adds the given list of
StateObjects as children of this one. |
void |
addListChangeListener(java.lang.String listName,
IListChangeListener<java.lang.String> listener)
Registers the given
IListChangeListener for the specified list. |
void |
append(java.lang.String text)
Appends the given sequence of characters to the path expression.
|
boolean |
canMoveDown(java.lang.String item)
Determines whether the given
StateObject can be moved down by one position in the
list owned by its parent. |
boolean |
canMoveUp(java.lang.String item)
Determines whether the given
StateObject can be moved up by one position in the list
owned by its parent. |
protected void |
clearResolvedObjects()
Clears the values related to the managed type and type.
|
AbstractPathExpression |
getExpression()
Returns the actual parsed object if this
StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
StateObject |
getIdentificationVariable()
Returns the
StateObject representing the identification variable that starts the path
expression, which can be a sample identification variable, a map value, map key or map entry
expression. |
java.lang.String |
getItem(int index)
Returns the
StateObject at the given positions from the list |
IManagedType |
getManagedType()
Returns
|
IMapping |
getMapping()
Returns
|
IMapping |
getMapping(int index)
Retrieves the
IMapping for the path at the given position. |
java.lang.String |
getPath()
Returns the string representation of the path expression.
|
IType |
getType()
Returns the
IType of the field handled by this object. |
ITypeDeclaration |
getTypeDeclaration()
Returns the
ITypeDeclaration of the field handled by this object. |
boolean |
hasIdentificationVariable()
Determines whether the identification variable is present.
|
boolean |
hasItems()
Determines whether this
StateObject has any children. |
protected void |
initialize()
Initializes this state object.
|
boolean |
isEquivalent(StateObject stateObject)
Determines whether the given
StateObject is equivalent to this one, i.e. the
information of both StateObject is the same. |
ListIterable<java.lang.String> |
items()
Returns an
ListIterable over the children. |
int |
itemsSize()
Returns the number of children this list holder has.
|
java.lang.String |
moveDown(java.lang.String item)
Moves the given
StateObject down by one position in the list owned by its parent. |
java.lang.String |
moveUp(java.lang.String item)
Moves the given
StateObject up by one position in the list owned by its parent. |
void |
removeItem(int index)
Removes the single path at the given index.
|
void |
removeItem(java.lang.String item)
Removes the given
StateObject from the list of children. |
void |
removeItems(java.util.Collection<java.lang.String> items)
Removes the given
StateObject from the list of children. |
void |
removeListChangeListener(java.lang.String listName,
IListChangeListener<java.lang.String> listener)
Unregisters the given
IListChangeListener that was registered for the specified list. |
protected abstract IManagedType |
resolveManagedType()
Resolves
|
protected void |
resolveMappings()
Resolves the
IMapping objects that constitutes the path expression. |
protected abstract IType |
resolveType()
Resolves the
IType of the property handled by this object. |
protected ITypeDeclaration |
resolveTypeDeclaration()
Resolves the
ITypeDeclaration of the property handled by this object. |
void |
setIdentificationVariable(StateObject identificationVariable)
Sets the
StateObject representing the identification variable that starts the path
expression, which can be a sample identification variable, a map value, map key or map entry
expression. |
protected void |
setIdentificationVariableInternally(StateObject identificationVariable)
Sets the
StateObject representing the identification variable that starts the path
expression, which can be a sample identification variable, a map value, map key or map entry
expression. |
void |
setPath(java.lang.CharSequence path)
Changes the path expression with the list of segments, the identification variable will also
be updated with the first segment.
|
void |
setPath(int index,
java.lang.String path)
Replaces the existing path segment to become the given one.
|
void |
setPaths(java.util.List<java.lang.String> paths)
Changes the path expression with the list of segments, the identification variable will also
be updated with the first segment.
|
void |
setPaths(java.util.ListIterator<java.lang.String> paths)
Changes the path expression with the list of segments, the identification variable will also
be updated with the first segment.
|
void |
setPaths(java.lang.String... paths)
Changes the path expression with the list of segments, the identification variable will also
be updated with the first segment.
|
protected void |
toTextInternal(java.lang.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. |
acceptUnknownVisitor, acceptUnknownVisitor, addProblems, addPropertyChangeListener, areEquivalent, buildProblem, buildProblem, buildStateObject, buildStateObjects, checkParent, children, decorate, equals, findIdentificationVariable, firePropertyChanged, getChangeSupport, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, getType, getType, getTypeHelper, getTypeRepository, hashCode, isDecorated, parent, parent, parent, removePropertyChangeListener, setExpression, setParent, toString, toString, toStringInternal, toStringItems, toTextclone, finalize, getClass, notify, notifyAll, wait, wait, waitaccept, addPropertyChangeListener, children, decorate, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toTextpublic static final java.lang.String IDENTIFICATION_VARIABLE_PROPERTY
public static final java.lang.String PATHS_LIST
protected AbstractPathExpressionStateObject(StateObject parent)
AbstractPathExpressionStateObject.parent - The parent of this state object, which cannot be nulljava.lang.NullPointerException - The given parent cannot be nullprotected AbstractPathExpressionStateObject(StateObject parent, java.lang.String path)
AbstractPathExpressionStateObject.parent - The parent of this state object, which cannot be nullpath - The path expressionjava.lang.NullPointerException - The given parent cannot be nullprotected void addChildren(java.util.List<StateObject> children)
StateObject to the given list.addChildren in class AbstractStateObjectchildren - The list used to store the childrenpublic java.lang.String addItem(java.lang.String item)
StateObject as a child of this one.addItem in interface ListHolderStateObject<java.lang.String>item - The child StateObject to become a child of this one
return The given itempublic void addItems(java.util.List<? extends java.lang.String> items)
StateObjects as children of this one.addItems in interface ListHolderStateObject<java.lang.String>items - The StateObjects to become children of this onepublic void addListChangeListener(java.lang.String listName,
IListChangeListener<java.lang.String> listener)
IListChangeListener for the specified list. The listener will be
notified only when items are added, removed, moved from the list.addListChangeListener in interface ListHolderStateObject<java.lang.String>listName - The name of the list for which the listener will be notified when the content
of the list has changedlistener - The listener to be notified upon changespublic void append(java.lang.String text)
text - The sequence of characters to append to the path expressionpublic boolean canMoveDown(java.lang.String item)
StateObject can be moved down by one position in the
list owned by its parent.canMoveDown in interface ListHolderStateObject<java.lang.String>item - The StateObject that could potentially be moved downtrue if the object can be moved down by one unit; false
otherwisepublic boolean canMoveUp(java.lang.String item)
StateObject can be moved up by one position in the list
owned by its parent.canMoveUp in interface ListHolderStateObject<java.lang.String>item - The StateObject that could potentially be moved uptrue if the object can be moved up by one unit; false
otherwiseprotected void clearResolvedObjects()
public AbstractPathExpression getExpression()
StateObject representation of the JPQL query
was created by parsing an existing JPQL query.getExpression in interface StateObjectgetExpression in class AbstractStateObjectStateObject
or null when the JPQL query is manually created (i.e. not from a string)public StateObject getIdentificationVariable()
StateObject representing the identification variable that starts the path
expression, which can be a sample identification variable, a map value, map key or map entry
expression.public java.lang.String getItem(int index)
StateObject at the given positions from the listgetItem in interface ListHolderStateObject<java.lang.String>index - The position of the StateObject to retrieveStateObject at the given positionpublic IManagedType getManagedType()
public IMapping getMapping()
public IMapping getMapping(int index)
IMapping for the path at the given position.index - The index of the path for which its IMapping should be retrieved, which
should start at 1 to skip the identification variablepublic java.lang.String getPath()
nullpublic IType getType()
IType of the field handled by this object.IType that was resolved by this state object or the IType
for IType.UNRESOLVABLE_TYPE if it could not be resolvedpublic ITypeDeclaration getTypeDeclaration()
ITypeDeclaration of the field handled by this object.ITypeDeclaration that was resolved by this object or the ITypeDeclaration for IType.UNRESOLVABLE_TYPE if it could not be resolvedpublic boolean hasIdentificationVariable()
true the identification variable is present; false otherwisepublic boolean hasItems()
StateObject has any children.hasItems in interface ListHolderStateObject<java.lang.String>true if this StateObject has children; false otherwiseprotected void initialize()
initialize in class AbstractStateObjectpublic boolean isEquivalent(StateObject stateObject)
StateObject is equivalent to this one, i.e. the
information of both StateObject is the same.isEquivalent in interface StateObjectisEquivalent in class AbstractStateObjectstateObject - The StateObject to compare its content to this onetrue if both object are equivalent; false otherwisepublic ListIterable<java.lang.String> items()
ListIterable over the children.items in interface ListHolderStateObject<java.lang.String>ListIterable that is iterating over the childrenpublic int itemsSize()
itemsSize in interface ListHolderStateObject<java.lang.String>StateObjects that are children of this onepublic java.lang.String moveDown(java.lang.String item)
StateObject down by one position in the list owned by its parent.moveDown in interface ListHolderStateObject<java.lang.String>item - The StateObject to move down in the listpublic java.lang.String moveUp(java.lang.String item)
StateObject up by one position in the list owned by its parent.moveUp in interface ListHolderStateObject<java.lang.String>item - The StateObject to move up in the listpublic void removeItem(int index)
index - The position of the single path to remove. If the index is 0, then the
identification variable is nullifiedpublic void removeItem(java.lang.String item)
StateObject from the list of children.removeItem in interface ListHolderStateObject<java.lang.String>item - The child StateObject to not longer be a childpublic void removeItems(java.util.Collection<java.lang.String> items)
StateObject from the list of children.removeItems in interface ListHolderStateObject<java.lang.String>items - The StateObjects to remove from this onepublic void removeListChangeListener(java.lang.String listName,
IListChangeListener<java.lang.String> listener)
IListChangeListener that was registered for the specified list.
The listener will no longer be notified only when items are added, removed, moved from the
list.removeListChangeListener in interface ListHolderStateObject<java.lang.String>listName - The name of the list for which the listener was registeredlistener - The listener to unregisterprotected abstract IManagedType resolveManagedType()
protected void resolveMappings()
IMapping objects that constitutes the path expression.protected abstract IType resolveType()
IType of the property handled by this object.IType that was resolved by this object or the IType for
IType.UNRESOLVABLE_TYPE if it could not be resolvedprotected ITypeDeclaration resolveTypeDeclaration()
ITypeDeclaration of the property handled by this object.ITypeDeclaration that was resolved by this object or the ITypeDeclaration for IType.UNRESOLVABLE_TYPE if it could not be resolvedpublic void setIdentificationVariable(StateObject identificationVariable)
StateObject representing the identification variable that starts the path
expression, which can be a sample identification variable, a map value, map key or map entry
expression.identificationVariable - The root of the path expressionprotected void setIdentificationVariableInternally(StateObject identificationVariable)
StateObject representing the identification variable that starts the path
expression, which can be a sample identification variable, a map value, map key or map entry
expression. This method does not replace the first path in the list of paths.identificationVariable - The root of the path expressionpublic void setPath(java.lang.CharSequence path)
path - The new path expressionpublic void setPath(int index,
java.lang.String path)
index - The position of the path segment to replacepath - The replacementpublic void setPaths(java.util.List<java.lang.String> paths)
paths - The new path expressionpublic void setPaths(java.util.ListIterator<java.lang.String> paths)
paths - The new path expressionpublic void setPaths(java.lang.String... paths)
paths - The new path expressionprotected void toTextInternal(java.lang.Appendable writer)
throws java.io.IOException
StateObject, which should not be used to
define a true string representation of a JPQL query but should be used for
debugging purposes.toTextInternal in class AbstractStateObjectwriter - The writer used to print out the string representationjava.io.IOException - This should never happens, it is only required because Appendable
is used instead of any concrete class