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

public abstract Class AbstractListHolderStateObject<T extends StateObject>

extends AbstractStateObject
implements ListHolderStateObject<T extends StateObject>
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
Known Direct Subclasses
org.eclipse.persistence.jpa.jpql.tools.model.query.CaseExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.ConcatExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.ConstructorExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.GroupByClauseStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.InExpressionStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.OrderByClauseStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractFromClauseStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractIdentificationVariableDeclarationStateObject
Imports
java.io.IOException, java.util.ArrayList, .Collection, .Collections, .List, org.eclipse.persistence.jpa.jpql.tools.model.IListChangeListener, org.eclipse.persistence.jpa.jpql.utility.iterable.ListIterable, .SnapshotCloneListIterable

The abstraction definition of a StateObject that holds onto a list of children, the methods defined in ListHolderStateObject are automatically handled here.
Author
Pascal Filion
Since
2.4
Version
2.4

Field Summary

Modifier and TypeField and Description
private List<T>
items

The list of children owned by this one.

Constructor Summary

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

Creates a new AbstractListHolderStateObject.

protected
AbstractListHolderStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
List<? extends T>
The list of StateObjects to add as children to this one
items
)

Creates a new AbstractListHolderStateObject.

protected
AbstractListHolderStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
T...
The list of StateObjects to add as children to this one
items
)

Creates a new AbstractListHolderStateObject.

Method Summary

Modifier and TypeMethod and Description
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.
public <S extends T> S
addItem(S
The child StateObject to become a child of this one return The given item
item
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItem.

Adds the given StateObject as a child of this one.
public void
addItems(List<? extends T>
The StateObjects to become children of this one
items
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItems.

Adds the given list of StateObjects as children of this one.
public void
addListChangeListener(String
The name of the list for which the listener will be notified when the content of the list has changed
listName
,
IListChangeListener<T>
The listener to be notified upon changes
listener
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addListChangeListener.

Registers the given IListChangeListener for the specified list.
protected boolean

Returns:

true if both have equivalent children; false otherwise
areChildrenEquivalent
(AbstractListHolderStateObject<? extends StateObject>
The StateObject to compare its children to this one's children
stateObject
)

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

public boolean
canMoveDown(T
The StateObject that could potentially be moved down
stateObject
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveDown.

Determines whether the given StateObject can be moved down by one position in the list owned by its parent.
public boolean
canMoveUp(T
The StateObject that could potentially be moved up
stateObject
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveUp.

Determines whether the given StateObject can be moved up by one position in the list owned by its parent.
public T
getItem(int
The position of the StateObject to retrieve
index
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.getItem.

Returns the StateObject at the given positions from the list
public boolean
protected void
public ListIterable<? extends T>
public int
itemsSize()

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.itemsSize.

Returns the number of children this list holder has.
protected abstract String

Returns:

The unique name identifying the list
listName
()

Returns the name that is uniquely identifying the list.

public T
moveDown(T
The StateObject to move down in the list
item
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveDown.

Moves the given StateObject down by one position in the list owned by its parent.
public T
moveUp(T
The StateObject to move up in the list
item
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveUp.

Moves the given StateObject up by one position in the list owned by its parent.
public void
removeItem(T
The child StateObject to not longer be a child
stateObject
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeItem.

Removes the given StateObject from the list of children.
public void
removeItems(Collection<T>
The StateObjects to remove from this one
items
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeItems.

Removes the given StateObject from the list of children.
public void
removeListChangeListener(String
The name of the list for which the listener was registered
listName
,
IListChangeListener<T>
The listener to unregister
listener
)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeListChangeListener.

Unregisters the given IListChangeListener that was registered for the specified list.
protected void
toStringItems(Appendable
The writer used to print out the string representation
writer
,
boolean
Determines whether a comma should be added after each item, except after the last one
useComma
)

Adds to the given writer a crude string representation of the children of this one.

Inherited from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractStateObject:
acceptUnknownVisitoracceptUnknownVisitoraddProblemsaddPropertyChangeListenerareEquivalentbuildProblembuildProblembuildStateObjectbuildStateObjectscheckParentchildrendecorateequalsfindIdentificationVariablefirePropertyChangedgetChangeSupportgetDeclarationgetDecoratorgetExpressiongetGrammargetManagedTypeProvidergetParentgetQueryBuildergetRootgetTypegetTypegetTypeHelpergetTypeRepositoryhashCodeisDecoratedisEquivalentparentparentparentremovePropertyChangeListenersetExpressionsetParenttoStringtoStringtoStringInternaltoStringItemstoTexttoTextInternal

Field Detail

itemsback to summary
private List<T> items

The list of children owned by this one.

Constructor Detail

AbstractListHolderStateObjectback to summary
protected AbstractListHolderStateObject(StateObject parent)

Creates a new AbstractListHolderStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
AbstractListHolderStateObjectback to summary
protected AbstractListHolderStateObject(StateObject parent, List<? extends T> items)

Creates a new AbstractListHolderStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

items:List<? extends T>

The list of StateObjects to add as children to this one

Exceptions
NullPointerException:
The given parent cannot be null
AbstractListHolderStateObjectback to summary
protected AbstractListHolderStateObject(StateObject parent, T... items)

Creates a new AbstractListHolderStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

items:T[]

The list of StateObjects to add as children to this one

Annotations
@SafeVarargs
@SuppressWarnings:varargs
Exceptions
NullPointerException:
The given parent cannot be null

Method Detail

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
addItemback to summary
public <S extends T> S addItem(S item)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItem.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItem.

Adds the given StateObject as a child of this one.

Parameters
item:S

The child StateObject to become a child of this one return The given item

Annotations
@Override
addItemsback to summary
public void addItems(List<? extends T> items)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItems.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addItems.

Adds the given list of StateObjects as children of this one.

Parameters
items:List<? extends T>

The StateObjects to become children of this one

Annotations
@Override
addListChangeListenerback to summary
public void addListChangeListener(String listName, IListChangeListener<T> listener)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addListChangeListener.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.addListChangeListener.

Registers the given IListChangeListener for the specified list. The listener will be notified only when items are added, removed, moved from the list.

Parameters
listName:String

The name of the list for which the listener will be notified when the content of the list has changed

listener:IListChangeListener<T>

The listener to be notified upon changes

Annotations
@Override
areChildrenEquivalentback to summary
protected boolean areChildrenEquivalent(AbstractListHolderStateObject<? extends StateObject> stateObject)

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

Parameters
stateObject:AbstractListHolderStateObject<? extends StateObject>

The StateObject to compare its children to this one's children

Returns:boolean

true if both have equivalent children; false otherwise

canMoveDownback to summary
public boolean canMoveDown(T stateObject)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveDown.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveDown.

Determines whether the given StateObject can be moved down by one position in the list owned by its parent.

Parameters
stateObject:T

The StateObject that could potentially be moved down

Returns:boolean

true if the object can be moved down by one unit; false otherwise

Annotations
@Override
canMoveUpback to summary
public boolean canMoveUp(T stateObject)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveUp.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.canMoveUp.

Determines whether the given StateObject can be moved up by one position in the list owned by its parent.

Parameters
stateObject:T

The StateObject that could potentially be moved up

Returns:boolean

true if the object can be moved up by one unit; false otherwise

Annotations
@Override
getItemback to summary
public T getItem(int index)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.getItem.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.getItem.

Returns the StateObject at the given positions from the list

Parameters
index:int

The position of the StateObject to retrieve

Returns:T

The StateObject at the given position

Annotations
@Override
hasItemsback to summary
public boolean hasItems()

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.hasItems.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.hasItems.

Determines whether this StateObject has any children.

Returns:boolean

true if this StateObject has children; false otherwise

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
itemsback to summary
public ListIterable<? extends T> items()

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.items.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.items.

Returns an ListIterable over the children.

Returns:ListIterable<? extends T>

An ListIterable that is iterating over the children

Annotations
@Override
itemsSizeback to summary
public int itemsSize()

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.itemsSize.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.itemsSize.

Returns the number of children this list holder has.

Returns:int

The count of StateObjects that are children of this one

Annotations
@Override
listNameback to summary
protected abstract String listName()

Returns the name that is uniquely identifying the list.

Returns:String

The unique name identifying the list

moveDownback to summary
public T moveDown(T item)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveDown.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveDown.

Moves the given StateObject down by one position in the list owned by its parent.

Parameters
item:T

The StateObject to move down in the list

Returns:T

The given item

Annotations
@Override
moveUpback to summary
public T moveUp(T item)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveUp.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.moveUp.

Moves the given StateObject up by one position in the list owned by its parent.

Parameters
item:T

The StateObject to move up in the list

Returns:T

The given item

Annotations
@Override
removeItemback to summary
public void removeItem(T stateObject)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeItem.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeItem.

Removes the given StateObject from the list of children.

Parameters
stateObject:T

The child StateObject to not longer be a child

Annotations
@Override
removeItemsback to summary
public void removeItems(Collection<T> items)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeItems.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeItems.

Removes the given StateObject from the list of children.

Parameters
items:Collection<T>

The StateObjects to remove from this one

Annotations
@Override
removeListChangeListenerback to summary
public void removeListChangeListener(String listName, IListChangeListener<T> listener)

Implements org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeListChangeListener.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject.removeListChangeListener.

Unregisters the given 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.

Parameters
listName:String

The name of the list for which the listener was registered

listener:IListChangeListener<T>

The listener to unregister

Annotations
@Override
toStringItemsback to summary
protected void toStringItems(Appendable writer, boolean useComma) throws IOException

Adds to the given writer a crude string representation of the children of this one.

Parameters
writer:Appendable

The writer used to print out the string representation

useComma:boolean

Determines whether a comma should be added after each item, except after the last one

Exceptions
IOException:
This should never happens, only required because Appendable is used instead of StringBuilder for instance