Class ConstructorExpressionStateObject

  • All Implemented Interfaces:
    ListHolderStateObject<StateObject>, StateObject

    public class ConstructorExpressionStateObject
    extends AbstractListHolderStateObject<StateObject>
    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}*)

    Since:
    2.4
    Version:
    2.4
    Author:
    Pascal Filion
    See Also:
    ConstructorExpression
    • Constructor Detail

      • ConstructorExpressionStateObject

        public ConstructorExpressionStateObject​(StateObject parent)
        Creates a new ConstructorExpressionStateObject.
        Parameters:
        parent - The parent of this state object, which cannot be null
        Throws:
        NullPointerException - The given parent cannot be null
      • ConstructorExpressionStateObject

        public ConstructorExpressionStateObject​(StateObject parent,
                                                Class<?> type)
        Creates a new ConstructorExpressionStateObject.
        Parameters:
        parent - The parent of this state object, which cannot be null
        type - The fully qualified name of the Java class to instantiate
        Throws:
        NullPointerException - The given parent cannot be null
      • ConstructorExpressionStateObject

        public ConstructorExpressionStateObject​(StateObject parent,
                                                Class<?> type,
                                                List<? extends StateObject> constructorItems)
        Creates a new ConstructorExpressionStateObject.
        Parameters:
        parent - The parent of this state object, which cannot be null
        type - The Java class to instantiate
        constructorItems - The list of arguments
        Throws:
        NullPointerException - The given parent cannot be null
      • ConstructorExpressionStateObject

        public ConstructorExpressionStateObject​(StateObject parent,
                                                Class<?> type,
                                                String jpqlFragment)
        Creates a new ConstructorExpressionStateObject.
        Parameters:
        parent - The parent of this state object, which cannot be null
        type - The Java class to instantiate
        jpqlFragment - The portion of the JPQL query that represents the constructor's arguments
        Throws:
        NullPointerException - The given parent cannot be null
      • ConstructorExpressionStateObject

        public ConstructorExpressionStateObject​(StateObject parent,
                                                String className)
        Creates a new ConstructorExpressionStateObject.
        Parameters:
        parent - The parent of this state object, which cannot be null
        className - The fully qualified name of the Java class to instantiate
        Throws:
        NullPointerException - The given parent cannot be null
      • ConstructorExpressionStateObject

        public ConstructorExpressionStateObject​(StateObject parent,
                                                String className,
                                                List<? extends StateObject> constructorItems)
        Creates a new ConstructorExpressionStateObject.
        Parameters:
        parent - The parent of this state object, which cannot be null
        className - The fully qualified name of the Java class to instantiate
        constructorItems - The list of arguments
        Throws:
        NullPointerException - The given parent cannot be null
      • ConstructorExpressionStateObject

        public ConstructorExpressionStateObject​(StateObject parent,
                                                String className,
                                                String jpqlFragment)
        Creates a new ConstructorExpressionStateObject.
        Parameters:
        parent - The parent of this state object, which cannot be null
        className - The fully qualified name of the Java class to instantiate
        jpqlFragment - The portion of the JPQL query that represents the constructor's arguments
        Throws:
        NullPointerException - The given parent cannot be null
    • Method Detail

      • getClassName

        public String getClassName()
        Returns the fully qualified class name that will be used to retrieve the constructor.
        Returns:
        The fully qualified class name or an empty string if it is not defined
      • getType

        public IType getType()
        Returns the actual IType that was resolved or null if it could not be resolved.
        Returns:
        The actual IType
      • parse

        public void parse​(String jpqlFragment)
        Parses the given JPQL fragment, which represents the constructor's arguments.
        Parameters:
        jpqlFragment - The JPQL fragment, which represents either a single or multiple arguments
      • setClassName

        public void setClassName​(CharSequence className)
        Sets the fully qualified class name that will be used to retrieve the constructor.
        Parameters:
        className - The fully qualified class name
      • setClassName

        public void setClassName​(Class<?> type)
        Sets the fully qualified class name that will be used to retrieve the constructor.
        Parameters:
        type - The type used to retrieve its fully qualified class name
      • setExpression

        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 - The parsed object representing a NEW expression
      • setType

        public void setType​(IType type)
        Sets the actual IType and updates the class name.
        Parameters:
        type - The new IType