Module org.eclipse.persistence.core
Class ParameterExpression
java.lang.Object
org.eclipse.persistence.expressions.Expression
org.eclipse.persistence.internal.expressions.BaseExpression
org.eclipse.persistence.internal.expressions.ParameterExpression
- All Implemented Interfaces:
Serializable
,Cloneable
Used for parameterized expressions, such as expression defined in mapping queries.
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected Boolean
'True' indicates this expression can bind parameters 'False' indicates this expression cannot bind parameters Defaults to 'null' to indicate specific no preferenceprotected DatabaseField
The parameter field or name.protected boolean
protected Expression
The opposite side of the relation, this is used for conversion of the parameter using the others mapping.Fields inherited from class org.eclipse.persistence.internal.expressions.BaseExpression
baseExpression, builder
Fields inherited from class org.eclipse.persistence.expressions.Expression
currentAlias, hashCode, lastTable, selectIfOrderedBy, shouldUseUpperCaseForIgnoreCase
-
Constructor Summary
ConstructorDescriptionParameterExpression
(String fieldName) ParameterExpression
(String fieldName, Expression localbaseExpression, Object type) ParameterExpression
(DatabaseField field) ParameterExpression
(DatabaseField field, Expression localbaseExpression) -
Method Summary
Modifier and TypeMethodDescriptionReturn description.canBind()
INTERNAL: true indicates this expression can bind parameters false indicates this expression cannot bind parameters Defaults to null to indicate no specific preferenceint
INTERNAL: Compute a consistent hash-code for the expression.INTERNAL: Used for debug printing.boolean
INTERNAL: Return if the expression is equal to the other.This allows for nesting of parameterized expression.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)getField()
getField
(DatabaseField field) This allows for nesting of parametrized expression.The opposite side of the relation, this is used for conversion of the parameter using the others mapping.getType()
The inferred type of this parameter.getValue
(AbstractRecord translationRow, AbstractSession session) Extract the value from the row.getValue
(AbstractRecord translationRow, DatabaseQuery query, AbstractSession session) Extract the value from the row.boolean
INTERNAL:boolean
INTERNAL: Return true if this parameter expression maps to a property.boolean
INTERNAL:protected void
postCopyIn
(Map alreadyDone) INTERNAL: Used for cloning.void
printJava
(ExpressionJavaPrinter printer) INTERNAL: Print java for project class generationvoid
printSQL
(ExpressionSQLPrinter printer) INTERNAL: Print SQL onto the stream, using the ExpressionPrinter for contextrebuildOn
(Expression newBase) INTERNAL: This expression is built on a different base than the one we want.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.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 preferencevoid
setField
(DatabaseField field) INTERNAL: Used to set the internal field value.void
setIsProperty
(boolean isProperty) INTERNAL: Set to true if this parameter expression maps to a property value.void
setLocalBase
(Expression localBase) The opposite side of the relation, this is used for conversion of the parameter using the others mapping.void
The inferred type of this parameter.twistedForBaseAndContext
(Expression newBase, Expression context, Expression oldBase) INTERNAL: Rebuild against the base, with the values of parameters supplied by the context expression.protected void
validateParameterValueAgainstMapping
(Object value, boolean useBaseExpression) INTERNAL Validate the passed parameter against the local base mapping.valueFromObject
(Object object, AbstractSession session, AbstractRecord translationRow, int valueHolderPolicy, boolean isObjectUnregistered) INTERNAL: Return the value for in memory comparison.void
writeDescriptionOn
(BufferedWriter writer) INTERNAL: Used to print a debug form of the expression tree.void
writeFields
(ExpressionSQLPrinter printer, List<DatabaseField> newFields, SQLSelectStatement statement) INTERNAL: Append the parameter into the printer.void
writeSubexpressionsTo
(BufferedWriter writer, int indent) Print the base for debuggin purposes.Methods inherited from class org.eclipse.persistence.internal.expressions.BaseExpression
getBaseExpression, setBaseExpression, shallowClone
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, allOf, and, any, any, any, any, any, any, any, any, any, any, any, any, anyOf, anyOf, anyOfAllowingNone, anyOfAllowingNone, 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, getAlias, getAllowingNull, getAsOfClause, getAsOfClauseRecursively, getClonedField, getField, getFields, getFieldValue, getFunction, getFunction, getFunction, getFunction, 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, isConstantExpression, isDataExpression, isEmpty, isExpressionBuilder, isFieldExpression, isFragment, isFunctionExpression, isLiteralExpression, isLogicalExpression, isMapEntryExpression, isNull, isObjectExpression, 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, localDate, localDateTime, localTime, locate, locate, locate, mapEntry, mapKey, maximum, minimum, monthsBetween, newTime, nextDay, noneOf, normalize, 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, size, size, 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
-
Field Details
-
field
The parameter field or name. -
localBase
The opposite side of the relation, this is used for conversion of the parameter using the others mapping. -
isProperty
protected boolean isProperty -
canBind
'True' indicates this expression can bind parameters 'False' indicates this expression cannot bind parameters Defaults to 'null' to indicate specific no preference
-
-
Constructor Details
-
ParameterExpression
public ParameterExpression() -
ParameterExpression
-
ParameterExpression
-
ParameterExpression
-
ParameterExpression
-
-
Method Details
-
equals
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 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:
computeHashCode
in classExpression
-
basicDescription
Return description. Used for toString. -
descriptionOfNodeType
INTERNAL: Used for debug printing.- Overrides:
descriptionOfNodeType
in classExpression
-
get
This allows for nesting of parameterized expression. This is used for parameterizing object comparisons.- Overrides:
get
in classExpression
-
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 classBaseExpression
-
getField
-
setField
INTERNAL: Used to set the internal field value. -
getField
This allows for nesting of parametrized expression. This is used for parameterizing object comparisons.- Overrides:
getField
in classExpression
-
getLocalBase
The opposite side of the relation, this is used for conversion of the parameter using the others mapping. -
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
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
Extract the value from the row. This may require recursion if it is a nested parameter. -
getValue
Extract the value from the row. This may require recursion if it is a nested parameter. -
isParameterExpression
public boolean isParameterExpression()Description copied from class:Expression
INTERNAL:- Overrides:
isParameterExpression
in classExpression
-
isValueExpression
public boolean isValueExpression()INTERNAL:- Overrides:
isValueExpression
in classExpression
-
isProperty
public boolean isProperty()INTERNAL: Return true if this parameter expression maps to a property. -
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
INTERNAL: Used for cloning.- Overrides:
postCopyIn
in classBaseExpression
-
printSQL
INTERNAL: Print SQL onto the stream, using the ExpressionPrinter for context- Specified by:
printSQL
in classExpression
-
printJava
INTERNAL: Print java for project class generation- Overrides:
printJava
in classExpression
-
rebuildOn
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 classExpression
- See Also:
-
resetPlaceHolderBuilder
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 classBaseExpression
-
setIsProperty
public void setIsProperty(boolean isProperty) INTERNAL: Set to true if this parameter expression maps to a property value. -
setCanBind
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
The opposite side of the relation, this is used for conversion of the parameter using the others mapping.- Overrides:
setLocalBase
in classExpression
-
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 classExpression
-
validateParameterValueAgainstMapping
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 classExpression
- Parameters:
isObjectUnregistered
- true if object possibly not a clone, but is being conformed against the unit of work cache.
-
writeDescriptionOn
INTERNAL: Used to print a debug form of the expression tree.- Overrides:
writeDescriptionOn
in classExpression
- Throws:
IOException
-
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 classExpression
-
writeSubexpressionsTo
Print the base for debuggin purposes.- Overrides:
writeSubexpressionsTo
in classExpression
- Throws:
IOException
-