Top Description Fields Constructors Methods
org.eclipse.persistence.internal.expressions

public Class ParameterExpression

extends BaseExpression
Class Inheritance
Imports
java.io.BufferedWriter, .IOException, java.util.Collection, .List, .Map, org.eclipse.persistence.descriptors.ClassDescriptor, org.eclipse.persistence.exceptions.QueryException, org.eclipse.persistence.expressions.Expression, .ExpressionBuilder, org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.queries.ContainerPolicy, org.eclipse.persistence.internal.sessions.AbstractRecord, .AbstractSession, org.eclipse.persistence.mappings.DatabaseMapping, org.eclipse.persistence.queries.DatabaseQuery

Used for parameterized expressions, such as expression defined in mapping queries.

Field Summary

Modifier and TypeField and Description
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

protected DatabaseField
field

The parameter field or name.

protected boolean
protected Expression
localBase

The opposite side of the relation, this is used for conversion of the parameter using the others mapping.

pack-priv Object
type

The inferred type of the parameter.

Inherited from org.eclipse.persistence.internal.expressions.BaseExpression:
baseExpressionbuilder

Constructor Summary

AccessConstructor and Description
public
public
public
public
ParameterExpression(String fieldName, Expression localbaseExpression, Object type)

public
ParameterExpression(DatabaseField field, Expression localbaseExpression)

Method Summary

Modifier and TypeMethod and Description
public String
basicDescription()

Return description.

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

public int
computeHashCode()

Overrides org.eclipse.persistence.expressions.Expression.computeHashCode.

INTERNAL: Compute a consistent hash-code for the expression.
public String
public boolean
equals(Object
the reference object with which to compare.
object
)

Overrides org.eclipse.persistence.expressions.Expression.equals.

INTERNAL: Return if the expression is equal to the other.
public Expression
get(String attributeOrQueryKey)

Overrides org.eclipse.persistence.expressions.Expression.get.

This allows for nesting of parameterized expression.
public ExpressionBuilder
getBuilder()

Overrides org.eclipse.persistence.internal.expressions.BaseExpression.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)
public DatabaseField
public Expression
getField(DatabaseField field)

Overrides org.eclipse.persistence.expressions.Expression.getField.

This allows for nesting of parametrized expression.
public Expression
getLocalBase()

The opposite side of the relation, this is used for conversion of the parameter using the others mapping.

public Object
getType()

The inferred type of this parameter.

public Object
getValue(AbstractRecord translationRow, AbstractSession session)

Extract the value from the row.

public Object
getValue(AbstractRecord translationRow, DatabaseQuery query, AbstractSession session)

Extract the value from the row.

public boolean
public boolean
isProperty()

INTERNAL: Return true if this parameter expression maps to a property.

public boolean
protected void
postCopyIn(Map<K, V> alreadyDone)

Overrides org.eclipse.persistence.internal.expressions.BaseExpression.postCopyIn.

INTERNAL: Used for cloning.
public void
printJava(ExpressionJavaPrinter printer)

Overrides org.eclipse.persistence.expressions.Expression.printJava.

INTERNAL: Print java for project class generation
public void
printSQL(ExpressionSQLPrinter printer)

Implements abstract org.eclipse.persistence.expressions.Expression.printSQL.

INTERNAL: Print SQL onto the stream, using the ExpressionPrinter for context
public Expression
rebuildOn(Expression newBase)

Implements abstract org.eclipse.persistence.expressions.Expression.rebuildOn.

INTERNAL: This expression is built on a different base than the one we want.
public void
resetPlaceHolderBuilder(ExpressionBuilder queryBuilder)

Overrides org.eclipse.persistence.internal.expressions.BaseExpression.resetPlaceHolderBuilder.

INTERNAL: Search the tree for any expressions (like SubSelectExpressions) that have been built using a builder that is not attached to the query.
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

public void
setField(DatabaseField field)

INTERNAL: Used to set the internal field value.

public void
setIsProperty(boolean isProperty)

INTERNAL: Set to true if this parameter expression maps to a property value.

public void
setLocalBase(Expression localBase)

Overrides org.eclipse.persistence.expressions.Expression.setLocalBase.

The opposite side of the relation, this is used for conversion of the parameter using the others mapping.
public void
setType(Object type)

The inferred type of this parameter.

public Expression
twistedForBaseAndContext(Expression newBase, Expression context, Expression oldBase)

Overrides org.eclipse.persistence.expressions.Expression.twistedForBaseAndContext.

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.

public Object
valueFromObject(Object object, AbstractSession session, AbstractRecord translationRow, int valueHolderPolicy, boolean
true if object possibly not a clone, but is being conformed against the unit of work cache.
isObjectUnregistered
)

Overrides org.eclipse.persistence.expressions.Expression.valueFromObject.

INTERNAL: Return the value for in memory comparison.
public void
writeDescriptionOn(BufferedWriter writer)

Overrides org.eclipse.persistence.expressions.Expression.writeDescriptionOn.

INTERNAL: Used to print a debug form of the expression tree.
public void
writeFields(ExpressionSQLPrinter printer, List<DatabaseField> newFields, SQLSelectStatement statement)

Overrides org.eclipse.persistence.expressions.Expression.writeFields.

INTERNAL: Append the parameter into the printer.
public void
writeSubexpressionsTo(BufferedWriter writer, int indent)

Overrides org.eclipse.persistence.expressions.Expression.writeSubexpressionsTo.

Print the base for debuggin purposes.
Inherited from org.eclipse.persistence.internal.expressions.BaseExpression:
getBaseExpressionsetBaseExpressionshallowClone

Field Detail

canBindback to summary
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

fieldback to summary
protected DatabaseField field

The parameter field or name.

isPropertyback to summary
protected boolean isProperty
localBaseback to summary
protected Expression localBase

The opposite side of the relation, this is used for conversion of the parameter using the others mapping.

typeback to summary
pack-priv Object type

The inferred type of the parameter. Please note that the type might not be always initialized to correct value. It might be null if not initialized correctly.

Constructor Detail

ParameterExpressionback to summary
public ParameterExpression()
ParameterExpressionback to summary
public ParameterExpression(String fieldName)
ParameterExpressionback to summary
public ParameterExpression(DatabaseField field)
ParameterExpressionback to summary
public ParameterExpression(String fieldName, Expression localbaseExpression, Object type)
ParameterExpressionback to summary
public ParameterExpression(DatabaseField field, Expression localbaseExpression)

Method Detail

basicDescriptionback to summary
public String basicDescription()

Return description. Used for toString.

canBindback to summary
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

computeHashCodeback to summary
public int computeHashCode()

Overrides org.eclipse.persistence.expressions.Expression.computeHashCode.

INTERNAL: Compute a consistent hash-code for the expression. This is used to allow dynamic expression's SQL to be cached.

Annotations
@Override
descriptionOfNodeTypeback to summary
public String descriptionOfNodeType()

Overrides org.eclipse.persistence.expressions.Expression.descriptionOfNodeType.

INTERNAL: Used for debug printing.

Annotations
@Override
equalsback to summary
public boolean equals(Object object)

Overrides org.eclipse.persistence.expressions.Expression.equals.

INTERNAL: Return if the expression is equal to the other. This is used to allow dynamic expression's SQL to be cached.

Parameters
object:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

Doc from java.lang.Object.equals.

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
getback to summary
public Expression get(String attributeOrQueryKey)

Overrides org.eclipse.persistence.expressions.Expression.get.

This allows for nesting of parameterized expression. This is used for parameterizing object comparisons.

Annotations
@Override
getBuilderback to summary
public ExpressionBuilder getBuilder()

Overrides org.eclipse.persistence.internal.expressions.BaseExpression.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)

Annotations
@Override
getFieldback to summary
public DatabaseField getField()
getFieldback to summary
public Expression getField(DatabaseField field)

Overrides org.eclipse.persistence.expressions.Expression.getField.

This allows for nesting of parametrized expression. This is used for parameterizing object comparisons.

Annotations
@Override
getLocalBaseback to summary
public Expression getLocalBase()

The opposite side of the relation, this is used for conversion of the parameter using the others mapping.

getTypeback to summary
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

getValueback to summary
public Object getValue(AbstractRecord translationRow, AbstractSession session)

Extract the value from the row. This may require recursion if it is a nested parameter.

getValueback to summary
public Object getValue(AbstractRecord translationRow, DatabaseQuery query, AbstractSession session)

Extract the value from the row. This may require recursion if it is a nested parameter.

isParameterExpressionback to summary
public boolean isParameterExpression()

Overrides org.eclipse.persistence.expressions.Expression.isParameterExpression.

Doc from org.eclipse.persistence.expressions.Expression.isParameterExpression.

INTERNAL:

Annotations
@Override
isPropertyback to summary
public boolean isProperty()

INTERNAL: Return true if this parameter expression maps to a property.

isValueExpressionback to summary
public boolean isValueExpression()

Overrides org.eclipse.persistence.expressions.Expression.isValueExpression.

INTERNAL:

Annotations
@Override
postCopyInback to summary
protected void postCopyIn(Map<K, V> alreadyDone)

Overrides org.eclipse.persistence.internal.expressions.BaseExpression.postCopyIn.

INTERNAL: Used for cloning.

Annotations
@Override
printJavaback to summary
public void printJava(ExpressionJavaPrinter printer)

Overrides org.eclipse.persistence.expressions.Expression.printJava.

INTERNAL: Print java for project class generation

Annotations
@Override
printSQLback to summary
public void printSQL(ExpressionSQLPrinter printer)

Implements abstract org.eclipse.persistence.expressions.Expression.printSQL.

INTERNAL: Print SQL onto the stream, using the ExpressionPrinter for context

Annotations
@Override
rebuildOnback to summary
public Expression rebuildOn(Expression newBase)

Implements abstract org.eclipse.persistence.expressions.Expression.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

Annotations
@Override
resetPlaceHolderBuilderback to summary
public void resetPlaceHolderBuilder(ExpressionBuilder queryBuilder)

Overrides org.eclipse.persistence.internal.expressions.BaseExpression.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.

Annotations
@Override
setCanBindback to summary
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

setFieldback to summary
public void setField(DatabaseField field)

INTERNAL: Used to set the internal field value.

setIsPropertyback to summary
public void setIsProperty(boolean isProperty)

INTERNAL: Set to true if this parameter expression maps to a property value.

setLocalBaseback to summary
public void setLocalBase(Expression localBase)

Overrides org.eclipse.persistence.expressions.Expression.setLocalBase.

The opposite side of the relation, this is used for conversion of the parameter using the others mapping.

Annotations
@Override
setTypeback to summary
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

twistedForBaseAndContextback to summary
public Expression twistedForBaseAndContext(Expression newBase, Expression context, Expression oldBase)

Overrides org.eclipse.persistence.expressions.Expression.twistedForBaseAndContext.

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).

Annotations
@Override
validateParameterValueAgainstMappingback to summary
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

valueFromObjectback to summary
public Object valueFromObject(Object object, AbstractSession session, AbstractRecord translationRow, int valueHolderPolicy, boolean isObjectUnregistered)

Overrides org.eclipse.persistence.expressions.Expression.valueFromObject.

INTERNAL: Return the value for in memory comparison. This is only valid for valueable expressions.

Parameters
isObjectUnregistered:boolean

Doc from org.eclipse.persistence.expressions.Expression.valueFromObject.

true if object possibly not a clone, but is being conformed against the unit of work cache.

Annotations
@Override
writeDescriptionOnback to summary
public void writeDescriptionOn(BufferedWriter writer) throws IOException

Overrides org.eclipse.persistence.expressions.Expression.writeDescriptionOn.

INTERNAL: Used to print a debug form of the expression tree.

Annotations
@Override
writeFieldsback to summary
public void writeFields(ExpressionSQLPrinter printer, List<DatabaseField> newFields, SQLSelectStatement statement)

Overrides org.eclipse.persistence.expressions.Expression.writeFields.

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.

Annotations
@Override
writeSubexpressionsToback to summary
public void writeSubexpressionsTo(BufferedWriter writer, int indent) throws IOException

Overrides org.eclipse.persistence.expressions.Expression.writeSubexpressionsTo.

Print the base for debuggin purposes.

Annotations
@Override