Class ConstantExpression
- java.lang.Object
-
- org.eclipse.persistence.expressions.Expression
-
- org.eclipse.persistence.internal.expressions.ConstantExpression
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable
- Direct Known Subclasses:
CollectionExpression,DateConstantExpression
public class ConstantExpression extends Expression
Used for wrapping constant values.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.BooleancanBindprotected ExpressionlocalBaseprotected java.lang.Objectvalue-
Fields inherited from class org.eclipse.persistence.expressions.Expression
currentAlias, hashCode, lastTable, selectIfOrderedBy, shouldUseUpperCaseForIgnoreCase
-
-
Constructor Summary
Constructors Constructor Description ConstantExpression()ConstantExpression(java.lang.Object newValue, Expression baseExpression)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.BooleancanBind()INTERNAL: true indicates this expression can bind parameters false indicates this expression cannot bind parameters Defaults to null to indicate no specific preferenceintcomputeHashCode()INTERNAL: Compute a consistent hash-code for the expression.java.lang.StringdescriptionOfNodeType()INTERNAL: Used for debug printing.booleanequals(java.lang.Object object)INTERNAL: Return if the expression is equal to the other.ExpressionBuildergetBuilder()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)ExpressiongetLocalBase()java.lang.ObjectgetValue()booleanisConstantExpression()INTERNAL:booleanisValueExpression()INTERNAL:Expressionnormalize(ExpressionNormalizer normalizer)INTERNAL: Normalize collection of values if they are expressions.protected voidpostCopyIn(java.util.Map alreadyDone)INTERNAL: Used for cloning.voidprintJava(ExpressionJavaPrinter printer)INTERNAL: Print java for project class generationvoidprintSQL(ExpressionSQLPrinter printer)INTERNAL: Print SQL onto the stream, using the ExpressionPrinter for contextExpressionrebuildOn(Expression newBase)INTERNAL: This expression is built on a different base than the one we want.voidresetPlaceHolderBuilder(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.voidsetCanBind(java.lang.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 preferencevoidsetLocalBase(Expression e)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.voidsetValue(java.lang.Object value)ExpressiontwistedForBaseAndContext(Expression newBase, Expression context, Expression oldBase)INTERNAL: Rebuild myself against the base, with the values of parameters supplied by the context expression.java.lang.ObjectvalueFromObject(java.lang.Object object, AbstractSession session, AbstractRecord translationRow, int valueHolderPolicy, boolean isObjectUnregistered)INTERNAL: Return the value for in memory comparison.voidwriteDescriptionOn(java.io.BufferedWriter writer)INTERNAL: Used to print a debug form of the expression tree.voidwriteFields(ExpressionSQLPrinter printer, java.util.Vector newFields, SQLSelectStatement statement)INTERNAL: Append the constant value into the printer-
Methods inherited from class org.eclipse.persistence.expressions.Expression
addDate, addDate, addMonths, addMonths, alias, aliasForTable, all, all, all, all, all, all, all, all, all, all, all, all, all, allOf, and, any, any, any, any, any, any, any, any, any, any, any, any, any, anyOf, anyOf, anyOfAllowingNone, anyOfAllowingNone, as, as, ascending, asciiValue, asOf, assignAlias, assignTableAliasesStartingAt, average, between, between, between, between, between, between, between, between, between, caseConditionStatement, caseConditionStatement, caseStatement, caseStatement, cast, clone, cloneUsing, coalesce, coalesce, concat, containsAllKeyWords, containsAnyKeyWords, containsSubstring, containsSubstring, containsSubstringIgnoringCase, containsSubstringIgnoringCase, convertNodeToUseOuterJoin, convertToUseOuterJoin, copiedVersionFrom, count, create, create, createWithBaseLast, currentDate, currentDateDate, currentTime, currentTimeStamp, dateDifference, dateDifference, dateName, datePart, dateToString, decode, descending, difference, distinct, doesConform, doesConform, equal, equal, equal, equal, equal, equal, equal, equal, equal, equal, equalOuterJoin, equalOuterJoin, equalsIgnoreCase, equalsIgnoreCase, except, except, exceptAll, exceptAll, exists, existsNode, extract, extractFields, extractPrimaryKeyValues, extractValue, extractValues, extractXml, from, fromConstant, fromLiteral, get, get, getAlias, getAllowingNull, getAsOfClause, getAsOfClauseRecursively, getClonedField, getField, getField, getFields, getFieldValue, getFunction, getFunction, getFunction, getFunction, getFunction, getFunctionWithArguments, getFunctionWithArguments, getLeafDescriptor, getLeafMapping, getName, getNumberVal, getOperator, getOperator, getOwnedTables, getParameter, getParameter, getParameter, getProperty, getSelectionFields, getSelectionFields, getSession, getStringVal, getTable, getTable, getTableAliases, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, hasAsOfClause, hasBeenAliased, hashCode, hexToRaw, ifNull, in, in, in, in, in, in, in, in, in, in, in, in, index, indexOf, intersect, intersect, intersectAll, intersectAll, isClassTypeExpression, isCompoundExpression, isDataExpression, isEmpty, isExpressionBuilder, isFieldExpression, isFragment, isFunctionExpression, isLiteralExpression, isLogicalExpression, isMapEntryExpression, isNull, isObjectExpression, isParameterExpression, isQueryKeyExpression, isRelationExpression, isSubSelectExpression, isTableExpression, isTreatExpression, iterateOn, join, lastDay, leftJoin, leftPad, leftPad, leftTrim, leftTrim, length, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThan, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, lessThanEqual, like, like, like, like, likeIgnoreCase, likeIgnoreCase, literal, locate, locate, locate, mapEntry, mapKey, maximum, minimum, monthsBetween, newTime, nextDay, noneOf, not, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notEmpty, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notExists, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notLike, notLike, notLike, notLike, notNull, nullIf, nullsFirst, nullsLast, operator, or, performOperator, postfixSQL, prefixSQL, ref, regexp, regexp, registerIn, replace, replicate, replicate, resetCache, reverse, right, right, rightPad, rightPad, rightTrim, rightTrim, roundDate, selectIfOrderedBy, setSelectIfOrderedBy, shallowClone, size, size, some, some, some, some, some, some, some, some, some, some, some, some, some, sql, standardDeviation, subQuery, substring, substring, substring, substring, sum, toChar, toChar, toCharacter, toDate, toLowerCase, toNumber, toString, toString, toUpperCase, toUppercaseCasedWords, translate, treat, trim, trim, truncateDate, twist, type, union, union, unionAll, unionAll, validateNode, value, value, value, value, value, value, value, value, value, value, valueFromObject, variance, writeAlias, writeField, writeSubexpressionsTo
-
-
-
-
Field Detail
-
value
protected java.lang.Object value
-
localBase
protected Expression localBase
-
canBind
protected java.lang.Boolean canBind
-
-
Constructor Detail
-
ConstantExpression
public ConstantExpression()
-
ConstantExpression
public ConstantExpression(java.lang.Object newValue, Expression baseExpression)
-
-
Method Detail
-
equals
public boolean equals(java.lang.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:
equalsin classExpression
-
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:
computeHashCodein classExpression
-
descriptionOfNodeType
public java.lang.String descriptionOfNodeType()
INTERNAL: Used for debug printing.- Overrides:
descriptionOfNodeTypein classExpression
-
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:
getBuilderin classExpression
-
getLocalBase
public Expression getLocalBase()
-
getValue
public java.lang.Object getValue()
-
setValue
public void setValue(java.lang.Object value)
-
canBind
public java.lang.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(java.lang.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:ExpressionINTERNAL:- Overrides:
isConstantExpressionin classExpression
-
isValueExpression
public boolean isValueExpression()
INTERNAL:- Overrides:
isValueExpressionin classExpression
-
normalize
public Expression normalize(ExpressionNormalizer normalizer)
INTERNAL: Normalize collection of values if they are expressions. or collection of collection expressions.- Overrides:
normalizein classExpression
-
postCopyIn
protected void postCopyIn(java.util.Map alreadyDone)
INTERNAL: Used for cloning.- Overrides:
postCopyInin classExpression
-
printSQL
public void printSQL(ExpressionSQLPrinter printer)
INTERNAL: Print SQL onto the stream, using the ExpressionPrinter for context- Specified by:
printSQLin classExpression
-
printJava
public void printJava(ExpressionJavaPrinter printer)
INTERNAL: Print java for project class generation- Overrides:
printJavain classExpression
-
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:
rebuildOnin classExpression- See Also:
Expression.cloneUsing(Expression newBase)
-
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:
resetPlaceHolderBuilderin classExpression
-
setLocalBase
public void setLocalBase(Expression e)
Description copied from class:ExpressionINTERNAL: 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:
setLocalBasein classExpression
-
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:
twistedForBaseAndContextin classExpression
-
valueFromObject
public java.lang.Object valueFromObject(java.lang.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:
valueFromObjectin classExpressionisObjectUnregistered- true if object possibly not a clone, but is being conformed against the unit of work cache.
-
writeDescriptionOn
public void writeDescriptionOn(java.io.BufferedWriter writer) throws java.io.IOExceptionINTERNAL: Used to print a debug form of the expression tree.- Overrides:
writeDescriptionOnin classExpression- Throws:
java.io.IOException
-
writeFields
public void writeFields(ExpressionSQLPrinter printer, java.util.Vector newFields, SQLSelectStatement statement)
INTERNAL: Append the constant value into the printer- Overrides:
writeFieldsin classExpression
-
-