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

public Class InExpressionStateObject

extends AbstractListHolderStateObject<StateObject>
Class Inheritance
Annotations
@SuppressWarnings:nls, unused
Imports
java.io.IOException, java.util.List, org.eclipse.persistence.jpa.jpql.parser.InExpression, .InExpressionItemBNF

The state field path expression must have a string, numeric, or enum value. The literal and/or input parameter values must be like the same abstract schema type of the state field path expression in type.

The results of the subquery must be like the same abstract schema type of the state field path expression in type.

There must be at least one element in the comma separated list that defines the set of values for the IN expression. If the value of a state field path expression in an IN or NOT IN expression is NULL or unknown, the value of the expression is unknown.

JPA 1.0:

BNF: in_expression ::= state_field_path_expression [NOT] IN(in_item {, in_item}* | subquery)

JPA 2.0

BNF: in_expression ::= {state_field_path_expression | type_discriminator} [NOT] IN { ( in_item {, in_item}* ) | (subquery) | collection_valued_input_parameter }

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
InExpression

Field Summary

Modifier and TypeField and Description
public static final String
ITEMS_LIST

Notifies the list of items has changed.

private boolean
not

Determines whether the NOT identifier is part of the expression or not.

public static final String
NOT_PROPERTY

Notifies the visibility of the NOT identifier has changed.

private boolean
singleInputParameter

Determines whether what was parsed after the IN identifier is a single input parameter.

public static final String
STATE_OBJECT_PROPERTY

Notifies the StateObject representing the state field path expression or the input parameter has changed.

private StateObject
stateObject

The StateObject representing either the state field path expression or the type discriminator.

Constructor Summary

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

Creates a new InExpressionStateObject.

public
InExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
boolean
Determines whether the NOT identifier is part of the expression or not
not
,
String path, List<String>
The list of JPQL fragments that will be parsed and converted into StateObject
items
)

Creates a new InExpressionStateObject.

public
InExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
boolean
Determines whether the NOT identifier is part of the expression or not
not
,
String path, String
The
parameter
)

Creates a new InExpressionStateObject.

public
InExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject stateObject, boolean
Determines whether the NOT identifier is part of the expression or not
not
,
List<? extends StateObject> items)

Creates a new InExpressionStateObject.

public
InExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
StateObject stateFieldPath, List<? extends StateObject> items)

Creates a new InExpressionStateObject.

public
InExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String path, List<String>
The list of JPQL fragments that will be parsed and converted into StateObject
items
)

Creates a new InExpressionStateObject.

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.AbstractListHolderStateObject.addChildren.

Adds the children of this StateObject to the given list.
public InExpressionStateObject

Returns:

This object
addNot
()

Makes sure the NOT identifier is specified.

public InExpression
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 StateObject
getStateObject()

Returns

public boolean

Returns:

true if the NOT identifier is part of the expression; false otherwise
hasNot
()

Determines whether the NOT identifier is used or not.

public boolean
hasStateObject()

Determines whether

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 the only item is an input parameter; false otherwise
isSingleInputParameter
()

Determines whether what was parsed after the IN identifier is a single input parameter.

protected String
listName()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject.listName.

Returns the name that is uniquely identifying the list.
public void
parse(String
The portion of the query to parse
jpqlFragment
)

Parses the given JPQL fragment, which represents either a single or many items, the fragment will be parsed and converted into StateObject.

public void
removeNot()

Makes sure the NOT identifier is not specified.

public void
setExpression(InExpression
The parsed object representing an IN 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
setNot(boolean
true if the NOT identifier should be part of the expression; false otherwise
not
)

Sets whether the NOT identifier should be part of the expression or not.

public void
setSingleInputParameter(boolean
true if the only item is an input parameter; false otherwise
singleInputParameter
)

Sets whether what was parsed after the IN identifier is a single input parameter.

public void
setStateObject(StateObject stateObject)

Sets

public void
toggleNot()

Changes the visibility state of the NOT 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.AbstractListHolderStateObject:
addItemaddItemsaddListChangeListenerareChildrenEquivalentcanMoveDowncanMoveUpgetItemhasItemsinitializeitemsitemsSizemoveDownmoveUpremoveItemremoveItemsremoveListChangeListenertoStringItems

Field Detail

ITEMS_LISTback to summary
public static final String ITEMS_LIST

Notifies the list of items has changed.

notback to summary
private boolean not

Determines whether the NOT identifier is part of the expression or not.

NOT_PROPERTYback to summary
public static final String NOT_PROPERTY

Notifies the visibility of the NOT identifier has changed.

singleInputParameterback to summary
private boolean singleInputParameter

Determines whether what was parsed after the IN identifier is a single input parameter.

STATE_OBJECT_PROPERTYback to summary
public static final String STATE_OBJECT_PROPERTY

Notifies the StateObject representing the state field path expression or the input parameter has changed.

stateObjectback to summary
private StateObject stateObject

The StateObject representing either the state field path expression or the type discriminator.

Constructor Detail

InExpressionStateObjectback to summary
public InExpressionStateObject(StateObject parent)

Creates a new InExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
InExpressionStateObjectback to summary
public InExpressionStateObject(StateObject parent, boolean not, String path, List<String> items)

Creates a new InExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

not:boolean

Determines whether the NOT identifier is part of the expression or not

items:List<String>

The list of JPQL fragments that will be parsed and converted into StateObject

Exceptions
NullPointerException:
The given parent cannot be null
InExpressionStateObjectback to summary
public InExpressionStateObject(StateObject parent, boolean not, String path, String parameter)

Creates a new InExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

not:boolean

Determines whether the NOT identifier is part of the expression or not

parameter:String

The

Exceptions
NullPointerException:
The given parent cannot be null
InExpressionStateObjectback to summary
public InExpressionStateObject(StateObject parent, StateObject stateObject, boolean not, List<? extends StateObject> items)

Creates a new InExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

not:boolean

Determines whether the NOT identifier is part of the expression or not

Exceptions
NullPointerException:
The given parent cannot be null
InExpressionStateObjectback to summary
public InExpressionStateObject(StateObject parent, StateObject stateFieldPath, List<? extends StateObject> items)

Creates a new InExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
InExpressionStateObjectback to summary
public InExpressionStateObject(StateObject parent, String path, List<String> items)

Creates a new InExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

items:List<String>

The list of JPQL fragments that will be parsed and converted into StateObject

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.AbstractListHolderStateObject.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
addNotback to summary
public InExpressionStateObject addNot()

Makes sure the NOT identifier is specified.

Returns:InExpressionStateObject

This object

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

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
getStateObjectback to summary
public StateObject getStateObject()

Returns

hasNotback to summary
public boolean hasNot()

Determines whether the NOT identifier is used or not.

Returns:boolean

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

hasStateObjectback to summary
public boolean hasStateObject()

Determines whether

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
isSingleInputParameterback to summary
public boolean isSingleInputParameter()

Determines whether what was parsed after the IN identifier is a single input parameter.

Returns:boolean

true if the only item is an input parameter; false otherwise

listNameback to summary
protected String listName()

Implements abstract org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject.listName.

Doc from org.eclipse.persistence.jpa.jpql.tools.model.query.AbstractListHolderStateObject.listName.

Returns the name that is uniquely identifying the list.

Returns:String

The unique name identifying the list

Annotations
@Override
parseback to summary
public void parse(String jpqlFragment)

Parses the given JPQL fragment, which represents either a single or many items, the fragment will be parsed and converted into StateObject.

Parameters
jpqlFragment:String

The portion of the query to parse

removeNotback to summary
public void removeNot()

Makes sure the NOT identifier is not specified.

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

The parsed object representing an IN expression

setNotback to summary
public void setNot(boolean not)

Sets whether the NOT identifier should be part of the expression or not.

Parameters
not:boolean

true if the NOT identifier should be part of the expression; false otherwise

setSingleInputParameterback to summary
public void setSingleInputParameter(boolean singleInputParameter)

Sets whether what was parsed after the IN identifier is a single input parameter.

Parameters
singleInputParameter:boolean

true if the only item is an input parameter; false otherwise

setStateObjectback to summary
public void setStateObject(StateObject stateObject)

Sets

toggleNotback to summary
public void toggleNot()

Changes the visibility state of the NOT 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