public class ExpressionBuilder
extends org.eclipse.persistence.internal.expressions.ObjectExpression
Purpose: Allow for instances of expression to be created. Expressions are Java object-level representations of SQL "where" clauses. The expressions attempt to mirror Java code as closely as possible.
Example:
ExpressionBuilder employee = new ExpressionBuilder();
employee.get("firstName").equal("Bob").and(employee.get("lastName").equal("Smith"))
>> equivalent Java code: (employee.getFirstName().equals("Bob")) && (employee.getLastName().equals("Smith"))
>> equivalent SQL: (F_NAME = 'Bob') AND (L_NAME = 'Smith')
Expression,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected org.eclipse.persistence.internal.helper.DatabaseTable |
aliasedViewTable |
protected Class |
queryClass |
protected org.eclipse.persistence.internal.sessions.AbstractSession |
session |
protected org.eclipse.persistence.internal.expressions.SQLSelectStatement |
statement |
protected org.eclipse.persistence.internal.helper.DatabaseTable |
viewTable |
protected boolean |
wasAdditionJoinCriteriaUsed |
protected boolean |
wasQueryClassSetInternally |
castClass, derivedExpressions, descriptor, hasBeenAliased, joinSource, onClause, shouldUseOuterJoin, shouldUseOuterJoinForMultitableInheritanceasOfClause, derivedFields, derivedTables, hasBeenNormalized, tableAliasesbaseExpression, buildercurrentAlias, hashCode, lastTable, selectIfOrderedBy, shouldUseUpperCaseForIgnoreCase| Constructor and Description |
|---|
ExpressionBuilder()
PUBLIC:
Create a new ExpressionBuilder.
|
ExpressionBuilder(Class queryClass)
ADVANCED:
Create a new ExpressionBuilder representing instances of the argument class.
|
| Modifier and Type | Method and Description |
|---|---|
org.eclipse.persistence.internal.helper.DatabaseTable |
aliasForTable(org.eclipse.persistence.internal.helper.DatabaseTable table)
INTERNAL: Find the alias for a given table.
|
int |
assignTableAliasesStartingAt(int initialValue)
INTERNAL:
Assign aliases to any tables which I own.
|
String |
descriptionOfNodeType()
INTERNAL:
Used for debug printing.
|
boolean |
doesNotRepresentAnObjectInTheQuery()
INTERNAL:
There are cases (which we might want to eliminate?) where the expression builder
doesn't actually correspond to an object to be read.
|
boolean |
equals(Object expression)
INTERNAL:
Return if the expression is equal to the other.
|
org.eclipse.persistence.internal.helper.DatabaseTable |
getAliasedViewTable()
INTERNAL:
|
ExpressionBuilder |
getBuilder()
INTERNAL:
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)
|
ClassDescriptor |
getDescriptor()
INTERNAL:
Only usable after the session and class have been set.
|
ClassDescriptor |
getLeafDescriptor(DatabaseQuery query,
ClassDescriptor rootDescriptor,
org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
Lookup the descriptor for this item by traversing its expression recursively.
|
Class |
getQueryClass()
INTERNAL:
|
org.eclipse.persistence.internal.sessions.AbstractSession |
getSession()
INTERNAL:
|
org.eclipse.persistence.internal.expressions.SQLSelectStatement |
getStatement()
INTERNAL:
Return the statement that expression is for.
|
org.eclipse.persistence.internal.helper.DatabaseTable |
getViewTable()
INTERNAL:
|
boolean |
hasViewTable()
INTERNAL:
|
boolean |
isExpressionBuilder()
INTERNAL:
|
Expression |
normalize(org.eclipse.persistence.internal.expressions.ExpressionNormalizer normalizer)
INTERNAL:
Normalize the expression into a printable structure.
|
void |
printJava(org.eclipse.persistence.internal.expressions.ExpressionJavaPrinter printer)
INTERNAL:
Print java
|
Expression |
rebuildOn(Expression newBase)
INTERNAL:
This expression is built on a different base than the one we want.
|
protected Expression |
registerIn(Map alreadyDone)
INTERNAL:
Override Expression.registerIn to check if the new base expression
has already been provided for the clone.
|
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 |
setQueryClass(Class queryClass)
INTERNAL:
Set the class which this node represents.
|
void |
setQueryClassAndDescriptor(Class queryClass,
ClassDescriptor descriptor)
INTERNAL:
Set the class and descriptor which this node represents.
|
void |
setSession(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
Set the session in which we expect this expression to be translated.
|
void |
setStatement(org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)
INTERNAL:
Set the statement that expression is for.
|
void |
setViewTable(org.eclipse.persistence.internal.helper.DatabaseTable theTable)
INTERNAL:
This expression represents something read through a view table.
|
void |
setWasAdditionJoinCriteriaUsed(boolean joinCriteriaUsed)
INTERNAL:
If the additional Join Criteria for the class this builder represents has
been added to the statement then mark this as true.
|
Expression |
twistedForBaseAndContext(Expression newBase,
Expression context,
Expression oldBase)
INTERNAL:
Rebuild myself against the base, with the values of parameters supplied by the context
expression.
|
Object |
valueFromObject(Object object,
org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.sessions.AbstractRecord translationRow,
int valueHolderPolicy,
boolean isObjectUnregistered)
INTERNAL:
The expression builder represent the entire object, just return it.
|
boolean |
wasAdditionJoinCriteriaUsed()
INTERNAL:
If the additional Join Criteria for the class this builder represents has
been added to the statement this method will return true;
|
boolean |
wasQueryClassSetInternally()
INTERNAL:
Returns true if TopLink set the query class as opposed to the customer.
|
void |
writeDescriptionOn(BufferedWriter writer)
INTERNAL:
For debug printing purposes.
|
addDerivedExpression, additionalExpressionCriteria, additionalExpressionCriteriaMap, anyOf, anyOfAllowingNone, clearAliases, convertToCastDescriptor, copyDerivedExpressions, derivedExpressionNamed, derivedManualExpressionNamed, doNotUseOuterJoin, doUseOuterJoin, existingDerivedExpressionNamed, get, getAdditionalTables, getAllowingNull, getCastClass, getFields, getFirstNonAggregateExpressionAfterExpressionBuilder, getForUpdateOfFields, getJoinSource, getManualQueryKey, getOnClause, getOuterJoinExpIndex, getOwnedTables, getRelationTable, getSelectionFields, hasBeenAliased, hasDerivedExpressions, isDirectCollection, isDowncast, isObjectExpression, isTreatUsed, isUsingOuterJoinForMultitableInheritance, join, leftJoin, newDerivedExpressionNamed, newManualDerivedExpressionNamed, postCopyIn, postCopyIn, setCastClass, setJoinSource, setOnClause, setOuterJoinExpIndex, setShouldUseOuterJoinForMultitableInheritance, shouldUseOuterJoin, shouldUseOuterJoinForMultitableInheritance, treat, type, writeForUpdateOfFieldsaddDerivedField, addDerivedTable, asOf, assignAlias, assignAlias, copyCollection, existingDerivedField, existingDerivedTable, getAlias, getAliasedField, getAsOfClause, getContainingDescriptor, getField, getField, getField, getMapping, getQueryKeyOrNull, getTable, getTable, getTableAliases, hasAsOfClause, hasBeenNormalized, hasDerivedFields, hasDerivedTables, isAttribute, isDataExpression, iterateOn, newDerivedField, newDerivedTable, printSQL, setHasBeenNormalized, setTableAliases, tableAliasesDescription, writeSubexpressionsTogetBaseExpression, setBaseExpression, shallowCloneaddDate, addDate, addMonths, addMonths, alias, 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, anyOfAllowingNone, as, ascending, asciiValue, average, between, between, between, between, between, between, between, between, between, caseConditionStatement, caseConditionStatement, caseStatement, caseStatement, cast, clone, cloneUsing, coalesce, coalesce, computeHashCode, 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, getAsOfClauseRecursively, getClonedField, getFieldValue, getFunction, getFunction, getFunction, getFunction, getFunctionWithArguments, getLeafMapping, getName, getNumberVal, getOperator, getOperator, getParameter, getParameter, getParameter, getProperty, getSelectionFields, getStringVal, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, hashCode, hexToRaw, ifNull, in, in, in, in, in, in, in, in, in, in, in, in, index, indexOf, intersect, intersect, intersectAll, intersectAll, isClassTypeExpression, isCompoundExpression, isConstantExpression, isEmpty, isFieldExpression, isFragment, isFunctionExpression, isLiteralExpression, isLogicalExpression, isMapEntryExpression, isNull, isParameterExpression, isQueryKeyExpression, isRelationExpression, isSubSelectExpression, isTableExpression, isTreatExpression, isValueExpression, lastDay, 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, replace, replicate, replicate, resetCache, reverse, right, right, rightPad, rightPad, rightTrim, rightTrim, roundDate, selectIfOrderedBy, setLocalBase, 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, trim, trim, truncateDate, twist, union, union, unionAll, unionAll, validateNode, value, value, value, value, value, value, value, value, value, value, valueFromObject, variance, writeAlias, writeField, writeFieldsprotected transient org.eclipse.persistence.internal.sessions.AbstractSession session
protected Class queryClass
protected org.eclipse.persistence.internal.expressions.SQLSelectStatement statement
protected org.eclipse.persistence.internal.helper.DatabaseTable viewTable
protected org.eclipse.persistence.internal.helper.DatabaseTable aliasedViewTable
protected boolean wasQueryClassSetInternally
protected boolean wasAdditionJoinCriteriaUsed
public ExpressionBuilder()
public ExpressionBuilder(Class queryClass)
public boolean equals(Object expression)
equals in class org.eclipse.persistence.internal.expressions.ObjectExpressionpublic org.eclipse.persistence.internal.helper.DatabaseTable aliasForTable(org.eclipse.persistence.internal.helper.DatabaseTable table)
aliasForTable in class org.eclipse.persistence.internal.expressions.DataExpressionpublic int assignTableAliasesStartingAt(int initialValue)
assignTableAliasesStartingAt in class org.eclipse.persistence.internal.expressions.ObjectExpressionpublic String descriptionOfNodeType()
descriptionOfNodeType in class Expressionpublic boolean doesNotRepresentAnObjectInTheQuery()
public org.eclipse.persistence.internal.helper.DatabaseTable getAliasedViewTable()
public ExpressionBuilder getBuilder()
getBuilder in class org.eclipse.persistence.internal.expressions.BaseExpressionpublic ClassDescriptor getDescriptor()
getDescriptor in class org.eclipse.persistence.internal.expressions.ObjectExpressionpublic Class getQueryClass()
public org.eclipse.persistence.internal.sessions.AbstractSession getSession()
getSession in class Expressionpublic org.eclipse.persistence.internal.expressions.SQLSelectStatement getStatement()
public org.eclipse.persistence.internal.helper.DatabaseTable getViewTable()
public boolean hasViewTable()
public boolean isExpressionBuilder()
isExpressionBuilder in class Expressionpublic Expression normalize(org.eclipse.persistence.internal.expressions.ExpressionNormalizer normalizer)
normalize in class org.eclipse.persistence.internal.expressions.DataExpressionpublic void printJava(org.eclipse.persistence.internal.expressions.ExpressionJavaPrinter printer)
printJava in class Expressionpublic Expression rebuildOn(Expression newBase)
rebuildOn in class ExpressionExpression.cloneUsing(Expression newBase)public void resetPlaceHolderBuilder(ExpressionBuilder queryBuilder)
resetPlaceHolderBuilder in class org.eclipse.persistence.internal.expressions.BaseExpressionprotected Expression registerIn(Map alreadyDone)
registerIn in class ExpressionExpression.cloneUsing(Expression)public void setQueryClass(Class queryClass)
public void setQueryClassAndDescriptor(Class queryClass, ClassDescriptor descriptor)
public void setSession(org.eclipse.persistence.internal.sessions.AbstractSession session)
public void setStatement(org.eclipse.persistence.internal.expressions.SQLSelectStatement statement)
public void setViewTable(org.eclipse.persistence.internal.helper.DatabaseTable theTable)
public void setWasAdditionJoinCriteriaUsed(boolean joinCriteriaUsed)
public Expression twistedForBaseAndContext(Expression newBase, Expression context, Expression oldBase)
twistedForBaseAndContext in class Expressionpublic Object valueFromObject(Object object, org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.sessions.AbstractRecord translationRow, int valueHolderPolicy, boolean isObjectUnregistered)
valueFromObject in class ExpressionisObjectUnregistered - true if object possibly not a clone, but is being
conformed against the unit of work cache.public boolean wasAdditionJoinCriteriaUsed()
public boolean wasQueryClassSetInternally()
public ClassDescriptor getLeafDescriptor(DatabaseQuery query, ClassDescriptor rootDescriptor, org.eclipse.persistence.internal.sessions.AbstractSession session)
getLeafDescriptor in class Expressionpublic void writeDescriptionOn(BufferedWriter writer) throws IOException
writeDescriptionOn in class ExpressionIOExceptionCopyright © 2007–2021 Eclipse.org - EclipseLink Project. All rights reserved.