public class ConstructorExpressionStateObject extends AbstractListHolderStateObject<StateObject>
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.
constructor_expression ::= NEW constructor_name(constructor_item {, constructor_item}*)ConstructorExpression| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CLASS_NAME_PROPERTY
Notifies the class name property has changed.
|
static java.lang.String |
CONSTRUCTOR_ITEMS_LIST
Notify the list of
StateObjects representing the constructor items. |
| Constructor and Description |
|---|
ConstructorExpressionStateObject(StateObject parent)
Creates a new
ConstructorExpressionStateObject. |
ConstructorExpressionStateObject(StateObject parent,
java.lang.Class<?> type)
Creates a new
ConstructorExpressionStateObject. |
ConstructorExpressionStateObject(StateObject parent,
java.lang.Class<?> type,
java.util.List<? extends StateObject> constructorItems)
Creates a new
ConstructorExpressionStateObject. |
ConstructorExpressionStateObject(StateObject parent,
java.lang.Class<?> type,
java.lang.String jpqlFragment)
Creates a new
ConstructorExpressionStateObject. |
ConstructorExpressionStateObject(StateObject parent,
java.lang.String className)
Creates a new
ConstructorExpressionStateObject. |
ConstructorExpressionStateObject(StateObject parent,
java.lang.String className,
java.util.List<? extends StateObject> constructorItems)
Creates a new
ConstructorExpressionStateObject. |
ConstructorExpressionStateObject(StateObject parent,
java.lang.String className,
java.lang.String jpqlFragment)
Creates a new
ConstructorExpressionStateObject. |
| Modifier and Type | Method and Description |
|---|---|
void |
accept(StateObjectVisitor visitor)
Visits this
StateObject by the given visitor. |
java.lang.String |
getClassName()
Returns the fully qualified class name that will be used to retrieve the constructor.
|
ConstructorExpression |
getExpression()
Returns the actual parsed object if this
StateObject representation of the JPQL query
was created by parsing an existing JPQL query. |
IType |
getType()
Returns the actual
IType that was resolved or null if it could not be resolved. |
boolean |
isEquivalent(StateObject stateObject)
Determines whether the given
StateObject is equivalent to this one, i.e. the
information of both StateObject is the same. |
protected java.lang.String |
listName()
Returns the name that is uniquely identifying the list.
|
void |
parse(java.lang.String jpqlFragment)
Parses the given JPQL fragment, which represents the constructor's arguments.
|
protected IType |
resolveType()
Resolves the actual
IType based on the class name. |
void |
setClassName(java.lang.CharSequence className)
Sets the fully qualified class name that will be used to retrieve the constructor.
|
void |
setClassName(java.lang.Class<?> type)
Sets the fully qualified class name that will be used to retrieve the constructor.
|
protected void |
setClassNameInternally(java.lang.CharSequence className)
Sets the fully qualified class name that will be used to retrieve the constructor.
|
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. |
void |
setType(IType type)
Sets the actual
IType and updates the class name. |
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. |
addChildren, addItem, addItems, addListChangeListener, areChildrenEquivalent, canMoveDown, canMoveUp, getItem, hasItems, initialize, items, itemsSize, moveDown, moveUp, removeItem, removeItems, removeListChangeListener, toStringItemsacceptUnknownVisitor, 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, waitaddPropertyChangeListener, children, decorate, findIdentificationVariable, getDeclaration, getDecorator, getGrammar, getManagedTypeProvider, getParent, getQueryBuilder, getRoot, isDecorated, removePropertyChangeListener, setParent, toString, toTextpublic static final java.lang.String CLASS_NAME_PROPERTY
public static final java.lang.String CONSTRUCTOR_ITEMS_LIST
StateObjects representing the constructor items.public ConstructorExpressionStateObject(StateObject parent)
ConstructorExpressionStateObject.parent - The parent of this state object, which cannot be nulljava.lang.NullPointerException - The given parent cannot be nullpublic ConstructorExpressionStateObject(StateObject parent, java.lang.Class<?> type)
ConstructorExpressionStateObject.parent - The parent of this state object, which cannot be nulltype - The fully qualified name of the Java class to instantiatejava.lang.NullPointerException - The given parent cannot be nullpublic ConstructorExpressionStateObject(StateObject parent, java.lang.Class<?> type, java.util.List<? extends StateObject> constructorItems)
ConstructorExpressionStateObject.parent - The parent of this state object, which cannot be nulltype - The Java class to instantiateconstructorItems - The list of argumentsjava.lang.NullPointerException - The given parent cannot be nullpublic ConstructorExpressionStateObject(StateObject parent, java.lang.Class<?> type, java.lang.String jpqlFragment)
ConstructorExpressionStateObject.parent - The parent of this state object, which cannot be nulltype - The Java class to instantiatejpqlFragment - The portion of the JPQL query that represents the constructor's argumentsjava.lang.NullPointerException - The given parent cannot be nullpublic ConstructorExpressionStateObject(StateObject parent, java.lang.String className)
ConstructorExpressionStateObject.parent - The parent of this state object, which cannot be nullclassName - The fully qualified name of the Java class to instantiatejava.lang.NullPointerException - The given parent cannot be nullpublic ConstructorExpressionStateObject(StateObject parent, java.lang.String className, java.util.List<? extends StateObject> constructorItems)
ConstructorExpressionStateObject.parent - The parent of this state object, which cannot be nullclassName - The fully qualified name of the Java class to instantiateconstructorItems - The list of argumentsjava.lang.NullPointerException - The given parent cannot be nullpublic ConstructorExpressionStateObject(StateObject parent, java.lang.String className, java.lang.String jpqlFragment)
ConstructorExpressionStateObject.parent - The parent of this state object, which cannot be nullclassName - The fully qualified name of the Java class to instantiatejpqlFragment - The portion of the JPQL query that represents the constructor's argumentsjava.lang.NullPointerException - The given parent cannot be nullpublic void accept(StateObjectVisitor visitor)
StateObject by the given visitor.visitor - The visitor to visit this objectpublic java.lang.String getClassName()
public ConstructorExpression 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 IType getType()
IType that was resolved or null if it could not be resolved.ITypepublic boolean isEquivalent(StateObject stateObject)
AbstractStateObjectStateObject 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 otherwiseprotected java.lang.String listName()
listName in class AbstractListHolderStateObject<StateObject>public void parse(java.lang.String jpqlFragment)
jpqlFragment - The JPQL fragment, which represents either a single or multiple argumentsprotected IType resolveType()
IType based on the class name.IType with the fully qualified class namepublic void setClassName(java.lang.CharSequence className)
className - The fully qualified class namepublic void setClassName(java.lang.Class<?> type)
type - The type used to retrieve its fully qualified class nameprotected void setClassNameInternally(java.lang.CharSequence className)
className - The fully qualified class namepublic void setExpression(ConstructorExpression expression)
parsed object object, which should only
be done when this object is instantiated during the conversion of a parsed JPQL query into
StateObjects.expression - The parsed object representing a NEW
expressionpublic void setType(IType type)
IType and updates the class name.type - The new ITypeprotected 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