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

public Class FunctionExpressionStateObject

extends AbstractStateObject
implements ListHolderStateObject<StateObject>
Class Inheritance
All Implemented Interfaces
org.eclipse.persistence.jpa.jpql.tools.model.query.ListHolderStateObject, org.eclipse.persistence.jpa.jpql.tools.model.query.StateObject
Annotations
@SuppressWarnings:nls
Imports
java.io.IOException, java.util.ArrayList, .Collection, .List, org.eclipse.persistence.jpa.jpql.ExpressionTools, org.eclipse.persistence.jpa.jpql.parser.FunctionExpression, org.eclipse.persistence.jpa.jpql.tools.model.IListChangeListener, org.eclipse.persistence.jpa.jpql.utility.iterable.ListIterable, .SnapshotCloneListIterable

Author
Pascal Filion
Since
2.4
Version
2.4

Field Summary

Modifier and TypeField and Description
public static final String
ARGUMENTS_LIST

Notifies the list of arguments has changed.

public static final String
FUNCTION_NAME_PROPERTY

Notifies the function name property has changed.

private String
functionName

The name of the native database function.

private String
identifier

The JPQL identifier of the SQL expression.

private List<StateObject>
items

The list of StateObject representing the arguments to pass to the native database function.

Constructor Summary

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

Creates a new AbstractFunctionExpressionStateObject.

public
FunctionExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
The JPQL identifier of the SQL expression
identifier
,
String
The name of the native database function
functionName
,
List<? extends StateObject>
The list of StateObject representing the arguments to pass to the native database function
arguments
)

Creates a new AbstractFunctionExpressionStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
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 StateObject> 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 StateObject>
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<StateObject>
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
(FunctionExpressionStateObject
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(StateObject
The StateObject that could potentially be moved down
item
)

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(StateObject
The StateObject that could potentially be moved up
item
)

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 FunctionExpression
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 new name of the native database function
getFunctionName
()

Returns the name of the native database function.

public String

Returns:

The JPQL identifier
getIdentifier
()

Returns the JPQL identifier of this expression.

public StateObject
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 String

Returns:

The new name of the native database function, which is quoted
getQuotedFunctionName
()

Returns the quoted name of the native database function.

public boolean

Returns:

true if the function name has been specified; false otherwise
hasFunctionName
()

Determines whether the name of the native SQL function has been specified.

public boolean
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 ListIterable<StateObject>
public int
itemsSize()

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

Returns the number of children this list holder has.
public StateObject
moveDown(StateObject
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 StateObject
moveUp(StateObject
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(StateObject
The child StateObject to not longer be a child
item
)

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

Removes the given StateObject from the list of children.
public void
removeItems(Collection<StateObject>
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<StateObject>
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.
public void
setExpression(FunctionExpression
The parsed object representing a SQL expression
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
setFunctionName(String
The new name of the native database function, which should be unquoted
functionName
)

Sets the unquoted name of the native database function.

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:
acceptUnknownVisitoracceptUnknownVisitoraddProblemsaddPropertyChangeListenerareEquivalentbuildProblembuildProblembuildStateObjectbuildStateObjectscheckParentchildrendecorateequalsfindIdentificationVariablefirePropertyChangedgetChangeSupportgetDeclarationgetDecoratorgetGrammargetManagedTypeProvidergetParentgetQueryBuildergetRootgetTypegetTypegetTypeHelpergetTypeRepositoryhashCodeisDecoratedparentparentparentremovePropertyChangeListenersetExpressionsetParenttoStringtoStringtoStringInternaltoStringItemstoText

Field Detail

ARGUMENTS_LISTback to summary
public static final String ARGUMENTS_LIST

Notifies the list of arguments has changed.

FUNCTION_NAME_PROPERTYback to summary
public static final String FUNCTION_NAME_PROPERTY

Notifies the function name property has changed.

functionNameback to summary
private String functionName

The name of the native database function.

identifierback to summary
private String identifier

The JPQL identifier of the SQL expression.

itemsback to summary
private List<StateObject> items

The list of StateObject representing the arguments to pass to the native database function.

Constructor Detail

FunctionExpressionStateObjectback to summary
public FunctionExpressionStateObject(StateObject parent)

Creates a new AbstractFunctionExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
FunctionExpressionStateObjectback to summary
public FunctionExpressionStateObject(StateObject parent, String identifier, String functionName, List<? extends StateObject> arguments)

Creates a new AbstractFunctionExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

identifier:String

The JPQL identifier of the SQL expression

functionName:String

The name of the native database function

arguments:List<? extends StateObject>

The list of StateObject representing the arguments to pass to the native database function

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
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 StateObject> 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 StateObject> 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 StateObject>

The StateObjects to become children of this one

Annotations
@Override
addListChangeListenerback to summary
public void addListChangeListener(String listName, IListChangeListener<StateObject> 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<StateObject>

The listener to be notified upon changes

Annotations
@Override
areChildrenEquivalentback to summary
protected boolean areChildrenEquivalent(FunctionExpressionStateObject 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:FunctionExpressionStateObject

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(StateObject item)

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
item:StateObject

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(StateObject item)

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
item:StateObject

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

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
getFunctionNameback to summary
public String getFunctionName()

Returns the name of the native database function.

Returns:String

The new name of the native database function

getIdentifierback to summary
public String getIdentifier()

Returns the JPQL identifier of this expression.

Returns:String

The JPQL identifier

getItemback to summary
public StateObject 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:StateObject

The StateObject at the given position

Annotations
@Override
getQuotedFunctionNameback to summary
public String getQuotedFunctionName()

Returns the quoted name of the native database function.

Returns:String

The new name of the native database function, which is quoted

hasFunctionNameback to summary
public boolean hasFunctionName()

Determines whether the name of the native SQL function has been specified.

Returns:boolean

true if the function name has been specified; false otherwise

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
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
itemsback to summary
public ListIterable<StateObject> 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<StateObject>

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
moveDownback to summary
public StateObject moveDown(StateObject 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:StateObject

The StateObject to move down in the list

Returns:StateObject

The given item

Annotations
@Override
moveUpback to summary
public StateObject moveUp(StateObject 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:StateObject

The StateObject to move up in the list

Returns:StateObject

The given item

Annotations
@Override
removeItemback to summary
public void removeItem(StateObject item)

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
item:StateObject

The child StateObject to not longer be a child

Annotations
@Override
removeItemsback to summary
public void removeItems(Collection<StateObject> 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<StateObject>

The StateObjects to remove from this one

Annotations
@Override
removeListChangeListenerback to summary
public void removeListChangeListener(String listName, IListChangeListener<StateObject> 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<StateObject>

The listener to unregister

Annotations
@Override
setExpressionback to summary
public void setExpression(FunctionExpression 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:FunctionExpression

The parsed object representing a SQL expression

setFunctionNameback to summary
public void setFunctionName(String functionName)

Sets the unquoted name of the native database function.

Parameters
functionName:String

The new name of the native database function, which should be unquoted

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