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

public Class ConstructorExpressionStateObject

extends AbstractListHolderStateObject<StateObject>
Class Inheritance
Annotations
@SuppressWarnings:nls, unused
Imports
java.io.IOException, java.util.List, org.eclipse.persistence.jpa.jpql.ExpressionTools, org.eclipse.persistence.jpa.jpql.parser.ConstructorExpression, .ConstructorItemBNF, org.eclipse.persistence.jpa.jpql.tools.spi.IType

In the SELECT clause a constructor may be used in the SELECT list to return one or more Java instances. The specified class is not required to be an entity or to be mapped to the database. The constructor name must be fully qualified.

BNF: constructor_expression ::= NEW constructor_name(constructor_item {, constructor_item}*)

Author
Pascal Filion
Since
2.4
Version
2.4
See Also
ConstructorExpression

Field Summary

Modifier and TypeField and Description
public static final String
CLASS_NAME_PROPERTY

Notifies the class name property has changed.

private String
className

The fully qualified class name of the Java object to instantiate.

public static final String
CONSTRUCTOR_ITEMS_LIST

Notify the list of StateObjects representing the constructor items.

private IType
type

The actual type that was resolved based on the class name.

Constructor Summary

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

Creates a new ConstructorExpressionStateObject.

public
ConstructorExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
Class<?>
The fully qualified name of the Java class to instantiate
type
)

Creates a new ConstructorExpressionStateObject.

public
ConstructorExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
Class<?>
The Java class to instantiate
type
,
List<? extends StateObject>
The list of arguments
constructorItems
)

Creates a new ConstructorExpressionStateObject.

public
ConstructorExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
Class<?>
The Java class to instantiate
type
,
String
The portion of the JPQL query that represents the constructor's arguments
jpqlFragment
)

Creates a new ConstructorExpressionStateObject.

public
ConstructorExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
The fully qualified name of the Java class to instantiate
className
)

Creates a new ConstructorExpressionStateObject.

public
ConstructorExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
The fully qualified name of the Java class to instantiate
className
,
List<? extends StateObject>
The list of arguments
constructorItems
)

Creates a new ConstructorExpressionStateObject.

public
ConstructorExpressionStateObject(StateObject
The parent of this state object, which cannot be null
parent
,
String
The fully qualified name of the Java class to instantiate
className
,
String
The portion of the JPQL query that represents the constructor's arguments
jpqlFragment
)

Creates a new ConstructorExpressionStateObject.

Method Summary

Modifier and TypeMethod and Description
public void
public String

Returns:

The fully qualified class name or an empty string if it is not defined
getClassName
()

Returns the fully qualified class name that will be used to retrieve the constructor.

public ConstructorExpression
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 IType

Returns:

The actual IType
getType
()

Returns the actual IType that was resolved or null if it could not be resolved.

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.
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 JPQL fragment, which represents either a single or multiple arguments
jpqlFragment
)

Parses the given JPQL fragment, which represents the constructor's arguments.

protected IType

Returns:

The IType with the fully qualified class name
resolveType
()

Resolves the actual IType based on the class name.

public void
setClassName(CharSequence
The fully qualified class name
className
)

Sets the fully qualified class name that will be used to retrieve the constructor.

public void
setClassName(Class<?>
The type used to retrieve its fully qualified class name
type
)

Sets the fully qualified class name that will be used to retrieve the constructor.

protected void
setClassNameInternally(CharSequence
The fully qualified class name
className
)

Sets the fully qualified class name that will be used to retrieve the constructor.

public void
setExpression(ConstructorExpression
The parsed object representing a NEW 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
setType(IType
The new IType
type
)

Sets the actual IType and updates the class name.

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

Field Detail

CLASS_NAME_PROPERTYback to summary
public static final String CLASS_NAME_PROPERTY

Notifies the class name property has changed.

classNameback to summary
private String className

The fully qualified class name of the Java object to instantiate.

CONSTRUCTOR_ITEMS_LISTback to summary
public static final String CONSTRUCTOR_ITEMS_LIST

Notify the list of StateObjects representing the constructor items.

typeback to summary
private IType type

The actual type that was resolved based on the class name.

Constructor Detail

ConstructorExpressionStateObjectback to summary
public ConstructorExpressionStateObject(StateObject parent)

Creates a new ConstructorExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

Exceptions
NullPointerException:
The given parent cannot be null
ConstructorExpressionStateObjectback to summary
public ConstructorExpressionStateObject(StateObject parent, Class<?> type)

Creates a new ConstructorExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

type:Class<?>

The fully qualified name of the Java class to instantiate

Exceptions
NullPointerException:
The given parent cannot be null
ConstructorExpressionStateObjectback to summary
public ConstructorExpressionStateObject(StateObject parent, Class<?> type, List<? extends StateObject> constructorItems)

Creates a new ConstructorExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

type:Class<?>

The Java class to instantiate

constructorItems:List<? extends StateObject>

The list of arguments

Exceptions
NullPointerException:
The given parent cannot be null
ConstructorExpressionStateObjectback to summary
public ConstructorExpressionStateObject(StateObject parent, Class<?> type, String jpqlFragment)

Creates a new ConstructorExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

type:Class<?>

The Java class to instantiate

jpqlFragment:String

The portion of the JPQL query that represents the constructor's arguments

Exceptions
NullPointerException:
The given parent cannot be null
ConstructorExpressionStateObjectback to summary
public ConstructorExpressionStateObject(StateObject parent, String className)

Creates a new ConstructorExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

className:String

The fully qualified name of the Java class to instantiate

Exceptions
NullPointerException:
The given parent cannot be null
ConstructorExpressionStateObjectback to summary
public ConstructorExpressionStateObject(StateObject parent, String className, List<? extends StateObject> constructorItems)

Creates a new ConstructorExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

className:String

The fully qualified name of the Java class to instantiate

constructorItems:List<? extends StateObject>

The list of arguments

Exceptions
NullPointerException:
The given parent cannot be null
ConstructorExpressionStateObjectback to summary
public ConstructorExpressionStateObject(StateObject parent, String className, String jpqlFragment)

Creates a new ConstructorExpressionStateObject.

Parameters
parent:StateObject

The parent of this state object, which cannot be null

className:String

The fully qualified name of the Java class to instantiate

jpqlFragment:String

The portion of the JPQL query that represents the constructor's arguments

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
getClassNameback to summary
public String getClassName()

Returns the fully qualified class name that will be used to retrieve the constructor.

Returns:String

The fully qualified class name or an empty string if it is not defined

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

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
getTypeback to summary
public IType getType()

Returns the actual IType that was resolved or null if it could not be resolved.

Returns:IType

The actual IType

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
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 the constructor's arguments.

Parameters
jpqlFragment:String

The JPQL fragment, which represents either a single or multiple arguments

resolveTypeback to summary
protected IType resolveType()

Resolves the actual IType based on the class name.

Returns:IType

The IType with the fully qualified class name

setClassNameback to summary
public void setClassName(CharSequence className)

Sets the fully qualified class name that will be used to retrieve the constructor.

Parameters
className:CharSequence

The fully qualified class name

setClassNameback to summary
public void setClassName(Class<?> type)

Sets the fully qualified class name that will be used to retrieve the constructor.

Parameters
type:Class<?>

The type used to retrieve its fully qualified class name

setClassNameInternallyback to summary
protected void setClassNameInternally(CharSequence className)

Sets the fully qualified class name that will be used to retrieve the constructor.

Parameters
className:CharSequence

The fully qualified class name

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

The parsed object representing a NEW expression

setTypeback to summary
public void setType(IType type)

Sets the actual IType and updates the class name.

Parameters
type:IType

The new IType

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