Class ParameterExpression

    • Field Detail

      • field

        protected DatabaseField field
        The parameter field or name.
      • localBase

        protected Expression localBase
        The opposite side of the relation, this is used for conversion of the parameter using the others mapping.
      • isProperty

        protected boolean isProperty
      • canBind

        protected Boolean canBind
        'True' indicates this expression can bind parameters 'False' indicates this expression cannot bind parameters Defaults to 'null' to indicate specific no preference
    • Constructor Detail

      • ParameterExpression

        public ParameterExpression()
      • ParameterExpression

        public ParameterExpression​(String fieldName)
      • ParameterExpression

        public ParameterExpression​(DatabaseField field)
      • ParameterExpression

        public ParameterExpression​(String fieldName,
                                   Expression localbaseExpression,
                                   Object type)
    • Method Detail

      • equals

        public boolean equals​(Object object)
        INTERNAL: Return if the expression is equal to the other. This is used to allow dynamic expression's SQL to be cached.
        Overrides:
        equals in class Expression
      • computeHashCode

        public int computeHashCode()
        INTERNAL: Compute a consistent hash-code for the expression. This is used to allow dynamic expression's SQL to be cached.
        Overrides:
        computeHashCode in class Expression
      • basicDescription

        public String basicDescription()
        Return description. Used for toString.
      • get

        public Expression get​(String attributeOrQueryKey)
        This allows for nesting of parameterized expression. This is used for parameterizing object comparisons.
        Overrides:
        get in class Expression
      • getBuilder

        public ExpressionBuilder getBuilder()
        Return the expression builder which is the ultimate base of this expression, or null if there isn't one (shouldn't happen if we start from a root)
        Overrides:
        getBuilder in class BaseExpression
      • setField

        public void setField​(DatabaseField field)
        INTERNAL: Used to set the internal field value.
      • getField

        public Expression getField​(DatabaseField field)
        This allows for nesting of parametrized expression. This is used for parameterizing object comparisons.
        Overrides:
        getField in class Expression
      • getLocalBase

        public Expression getLocalBase()
        The opposite side of the relation, this is used for conversion of the parameter using the others mapping.
      • getType

        public Object getType()
        The inferred type of this parameter. Please note that the type might not be always initialized to correct value. It might be null if not initialized correctly
      • setType

        public void setType​(Object type)
        The inferred type of this parameter. Please note that the type might not be always initialized to correct value. It might be null if not initialized correctly
      • getValue

        public Object getValue​(AbstractRecord translationRow,
                               AbstractSession session)
        Extract the value from the row. This may require recursion if it is a nested parameter.
      • isProperty

        public boolean isProperty()
        INTERNAL: Return true if this parameter expression maps to a property.
      • canBind

        public Boolean canBind()
        INTERNAL: true indicates this expression can bind parameters false indicates this expression cannot bind parameters Defaults to null to indicate no specific preference
      • postCopyIn

        protected void postCopyIn​(Map alreadyDone)
        INTERNAL: Used for cloning.
        Overrides:
        postCopyIn in class BaseExpression
      • resetPlaceHolderBuilder

        public void resetPlaceHolderBuilder​(ExpressionBuilder queryBuilder)
        INTERNAL: Search the tree for any expressions (like SubSelectExpressions) that have been built using a builder that is not attached to the query. This happens in case of an Exists call using a new ExpressionBuilder(). This builder needs to be replaced with one from the query.
        Overrides:
        resetPlaceHolderBuilder in class BaseExpression
      • setIsProperty

        public void setIsProperty​(boolean isProperty)
        INTERNAL: Set to true if this parameter expression maps to a property value.
      • setCanBind

        public void setCanBind​(Boolean canBind)
        INTERNAL: Set to true if this expression can bind parameters Set to false if this expression cannot bind parameters Set to null to indicate no specific preference
      • setLocalBase

        public void setLocalBase​(Expression localBase)
        The opposite side of the relation, this is used for conversion of the parameter using the others mapping.
        Overrides:
        setLocalBase in class Expression
      • twistedForBaseAndContext

        public Expression twistedForBaseAndContext​(Expression newBase,
                                                   Expression context,
                                                   Expression oldBase)
        INTERNAL: Rebuild against the base, with the values of parameters supplied by the context expression. This is used for transforming a standalone expression (e.g. the join criteria of a mapping) into part of some larger expression. You normally would not call this directly, instead calling twist, (see the comment there for more details).
        Overrides:
        twistedForBaseAndContext in class Expression
      • validateParameterValueAgainstMapping

        protected void validateParameterValueAgainstMapping​(Object value,
                                                            boolean useBaseExpression)
        INTERNAL Validate the passed parameter against the local base mapping. Throw a QueryException if the parameter is of an incorrect class for object comparison. Added for Bug 245268
      • valueFromObject

        public Object valueFromObject​(Object object,
                                      AbstractSession session,
                                      AbstractRecord translationRow,
                                      int valueHolderPolicy,
                                      boolean isObjectUnregistered)
        INTERNAL: Return the value for in memory comparison. This is only valid for valueable expressions.
        Overrides:
        valueFromObject in class Expression
        isObjectUnregistered - true if object possibly not a clone, but is being conformed against the unit of work cache.
      • writeFields

        public void writeFields​(ExpressionSQLPrinter printer,
                                List<DatabaseField> newFields,
                                SQLSelectStatement statement)
        INTERNAL: Append the parameter into the printer. "Normal" ReadQuery never has ParameterExpression in it's select clause hence for a "normal" ReadQuery this method is never called. The reason this method was added is that UpdateAllQuery (in case temporary storage is required) creates a "helper" ReportQuery with ReportItem corresponding to each update expression - and update expression may be a ParameterExpression. The call created by "helper" ReportQuery is never executed - it's used during construction of insert call into temporary storage.
        Overrides:
        writeFields in class Expression