java.lang.Object
org.eclipse.persistence.expressions.Expression
org.eclipse.persistence.internal.expressions.ConstantExpression
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
CollectionExpression, DateConstantExpression

public class ConstantExpression extends Expression
Used for wrapping constant values.
See Also:
  • Field Details

  • Constructor Details

    • ConstantExpression

      public ConstantExpression()
    • ConstantExpression

      public ConstantExpression(Object newValue, Expression baseExpression)
  • Method Details

    • 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
    • descriptionOfNodeType

      public String descriptionOfNodeType()
      INTERNAL: Used for debug printing.
      Overrides:
      descriptionOfNodeType 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)
      Specified by:
      getBuilder in class Expression
    • getLocalBase

      public Expression getLocalBase()
    • getValue

      public Object getValue()
    • setValue

      public void setValue(Object value)
    • 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
    • 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
    • isConstantExpression

      public boolean isConstantExpression()
      Description copied from class: Expression
      INTERNAL:
      Overrides:
      isConstantExpression in class Expression
    • isValueExpression

      public boolean isValueExpression()
      INTERNAL:
      Overrides:
      isValueExpression in class Expression
    • normalize

      public Expression normalize(ExpressionNormalizer normalizer)
      INTERNAL: Normalize collection of values if they are expressions. or collection of collection expressions.
      Overrides:
      normalize in class Expression
    • postCopyIn

      protected void postCopyIn(Map alreadyDone)
      INTERNAL: Used for cloning.
      Overrides:
      postCopyIn in class Expression
    • printSQL

      public void printSQL(ExpressionSQLPrinter printer)
      INTERNAL: Print SQL onto the stream, using the ExpressionPrinter for context
      Specified by:
      printSQL in class Expression
    • printJava

      public void printJava(ExpressionJavaPrinter printer)
      INTERNAL: Print java for project class generation
      Overrides:
      printJava in class Expression
    • rebuildOn

      public Expression rebuildOn(Expression newBase)
      INTERNAL: This expression is built on a different base than the one we want. Rebuild it and return the root of the new tree
      Specified by:
      rebuildOn in class Expression
      See Also:
    • 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.
      Specified by:
      resetPlaceHolderBuilder in class Expression
    • setLocalBase

      public void setLocalBase(Expression e)
      Description copied from class: Expression
      INTERNAL: Set the local base expression, ie the one on the other side of the operator Most types will ignore this, since they don't need it.
      Overrides:
      setLocalBase in class Expression
    • twistedForBaseAndContext

      public Expression twistedForBaseAndContext(Expression newBase, Expression context, Expression oldBase)
      INTERNAL: Rebuild myself 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
    • 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
      Parameters:
      isObjectUnregistered - true if object possibly not a clone, but is being conformed against the unit of work cache.
    • writeDescriptionOn

      public void writeDescriptionOn(BufferedWriter writer) throws IOException
      INTERNAL: Used to print a debug form of the expression tree.
      Overrides:
      writeDescriptionOn in class Expression
      Throws:
      IOException
    • writeFields

      public void writeFields(ExpressionSQLPrinter printer, List<DatabaseField> newFields, SQLSelectStatement statement)
      INTERNAL: Append the constant value into the printer
      Overrides:
      writeFields in class Expression