<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Oracle Application Server TopLink API Reference
10g (9.0.4.3)

B10491-02

oracle.toplink.expressions
Class ExpressionBuilder

java.lang.Object
extended byoracle.toplink.expressions.Expression
extended byoracle.toplink.internal.expressions.DataExpression
extended byoracle.toplink.internal.expressions.ObjectExpression
extended byoracle.toplink.expressions.ExpressionBuilder
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable

public class ExpressionBuilder
extends oracle.toplink.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:

<blockquote>
                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')
</blockquote>
See Also:
Expression, Serialized Form

Field Summary

 

Fields inherited from class oracle.toplink.internal.expressions.ObjectExpression
derivedExpressions, descriptor

 

Constructor Summary
ExpressionBuilder()
          PUBLIC: Create a new ExpressionBuilder.
ExpressionBuilder(java.lang.Class queryClass)
          ADVANCED: Create a new ExpressionBuilder representing instances of the argument class.

 

Method Summary
 oracle.toplink.internal.helper.DatabaseTable aliasForTable(oracle.toplink.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.
 java.lang.String descriptionOfNodeType()
          INTERNAL: Used for debug printing.
 boolean doesNotRepresentAnObjectInTheQuery()
          INTERNAL: There are cases (which we might want to eliminate?)
 oracle.toplink.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)
 Descriptor getDescriptor()
          INTERNAL: Only usable after the session and class have been set.
 java.lang.Class getQueryClass()
          INTERNAL:
 oracle.toplink.publicinterface.Session getSession()
          INTERNAL:
 oracle.toplink.internal.expressions.SQLSelectStatement getStatement()
          INTERNAL: Return the statement that expression is for.
 oracle.toplink.internal.helper.DatabaseTable getViewTable()
          INTERNAL:
 boolean hasViewTable()
          INTERNAL:
 boolean isExpressionBuilder()
          INTERNAL:
 Expression multipleTableCriteria()
          INTERNAL: Return the expression to join the main table of this node to any auxiliary tables.
 Expression normalize(oracle.toplink.internal.expressions.ExpressionNormalizer normalizer)
          INTERNAL: Normalize the expression into a printable structure.
 Expression rebuildOn(Expression newBase)
          INTERNAL: This expression is built on a different base than the one we want.
 void setQueryClass(java.lang.Class queryClass)
          INTERNAL: Set the class which this node represents.
 void setSession(oracle.toplink.publicinterface.Session session)
          INTERNAL: Set the session in which we expect this expression to be translated.
 void setStatement(oracle.toplink.internal.expressions.SQLSelectStatement statement)
          INTERNAL: Set the statement that expression is for.
 void setViewTable(oracle.toplink.internal.helper.DatabaseTable theTable)
          INTERNAL: This expression represents something read through a view table.
 Expression twistedForBaseAndContext(Expression newBase, Expression context)
          INTERNAL: Rebuild myself against the base, with the values of parameters supplied by the context expression.
 void writeDescriptionOn(java.io.BufferedWriter writer)
          INTERNAL: For debug printing purposes.

 

Methods inherited from class oracle.toplink.internal.expressions.ObjectExpression
addDerivedExpression, additionalExpressionCriteria, anyOf, derivedExpressionNamed, derivedManualExpressionNamed, existingDerivedExpressionNamed, get, getAllowingNull, getFields, getManualQueryKey, isObjectExpression, newDerivedExpressionNamed, newManualDerivedExpressionNamed, postCopyIn, shouldUseOuterJoin

 

Methods inherited from class oracle.toplink.internal.expressions.DataExpression
addDerivedField, addDerivedTable, clearAliases, copyCollection, existingDerivedField, existingDerivedTable, getAliasedField, getBaseExpression, getField, getField, getField, getMapping, getOwnedTables, getQueryKeyOrNull, getTable, getTable, getTableAliases, hasAddedMappingCriteria, hasBeenAliased, isAttribute, isDataExpression, iterateOn, mappingCriteria, newDerivedField, newDerivedTable, printSQL, setHasAddedMappingCriteria, setTableAliases, tableAliasesDescription, writeSubexpressionsTo

 

Methods inherited from class oracle.toplink.expressions.Expression
addDate, addDate, addMonths, addMonths, and, anyOfAllowingNone, appendSQL, ascending, asciiValue, average, between, between, between, between, between, between, between, between, between, caseStatement, clone, cloneUsing, concat, containsAllKeyWords, containsAnyKeyWords, containsSubstring, containsSubstring, containsSubstringIgnoringCase, containsSubstringIgnoringCase, convertToUseOuterJoin, copiedVersionFrom, count, create, create, currentDate, dateDifference, dateDifference, dateName, datePart, dateToString, decode, descending, difference, distinct, doesConform, equal, equal, equal, equal, equal, equal, equal, equal, equal, equal, equalOuterJoin, equalOuterJoin, equalsIgnoreCase, equalsIgnoreCase, exists, extractPrimaryKeyValues, from, fromConstant, fromLiteral, get, getAllowingNull, getClonedField, getFieldValue, getFunction, getFunction, getFunction, getFunction, getFunctionWithArguments, getName, getOperator, getOperator, getParameter, getParameter, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThan, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, greaterThanEqual, hexToRaw, ifNull, in, in, in, in, in, in, in, in, in, in, in, in, indexOf, isCompoundExpression, isConstantExpression, isFieldExpression, isFunctionExpression, isLiteralExpression, isLogicalExpression, isNull, isParameterExpression, isQueryKeyExpression, isRelationExpression, isTableExpression, isValueExpression, lastDay, leftPad, leftPad, 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, likeIgnoreCase, likeIgnoreCase, maximum, minimum, monthsBetween, newTime, nextDay, not, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notBetween, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notEqual, notExists, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notIn, notLike, notLike, notNull, or, performOperator, postfixSQL, prefixSQL, printSQLWithoutConversion, ref, replace, replicate, replicate, reverse, right, right, rightPad, rightPad, rightTrim, rightTrim, roundDate, setLocalBase, shallowClone, standardDeviation, subQuery, substring, substring, sum, toCharacter, toDate, toLowerCase, toNumber, toString, toString, toUpperCase, toUppercaseCasedWords, translate, trim, truncateDate, twist, validateNode, value, value, value, value, value, value, value, value, value, value, valueFromObject, variance, writeFields

 

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

 

Constructor Detail

ExpressionBuilder

public ExpressionBuilder()
PUBLIC: Create a new ExpressionBuilder.

ExpressionBuilder

public ExpressionBuilder(java.lang.Class queryClass)
ADVANCED: Create a new ExpressionBuilder representing instances of the argument class. This can be used for the purpose of parallel expressions. This is a type of query that searches on the relationship between to un-related objects.
Method Detail

aliasForTable

public oracle.toplink.internal.helper.DatabaseTable aliasForTable(oracle.toplink.internal.helper.DatabaseTable table)
INTERNAL: Find the alias for a given table. Handle the special case where we are bogus and it should be aliased against our derived tables instead.

assignTableAliasesStartingAt

public int assignTableAliasesStartingAt(int initialValue)
INTERNAL: Assign aliases to any tables which I own. Start with t<initialValue>, and return the new value of the counter , i.e. if initialValue is one and I have tables ADDRESS and EMPLOYEE I will assign them t1 and t2 respectively, and return 3.
Overrides:
assignTableAliasesStartingAt in class Expression

descriptionOfNodeType

public java.lang.String descriptionOfNodeType()
INTERNAL: Used for debug printing.
Overrides:
descriptionOfNodeType in class Expression

doesNotRepresentAnObjectInTheQuery

public 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. Mostly this is the case where it's a data query in terms of tables, and the builder is only there to provide a base. It might be better to make tables able to serve as their own base, but it's very nice to have a known unique, shared base. In the meantime, this is a special case to make sure the builder doesn't get tables assigned.

getAliasedViewTable

public oracle.toplink.internal.helper.DatabaseTable getAliasedViewTable()
INTERNAL:

getBuilder

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

getDescriptor

public Descriptor getDescriptor()
INTERNAL: Only usable after the session and class have been set. Return the descriptor for the class this node represents.

getQueryClass

public java.lang.Class getQueryClass()
INTERNAL:

getSession

public oracle.toplink.publicinterface.Session getSession()
INTERNAL:
Overrides:
getSession in class Expression

getStatement

public oracle.toplink.internal.expressions.SQLSelectStatement getStatement()
INTERNAL: Return the statement that expression is for. This is used for the context in subselects.

getViewTable

public oracle.toplink.internal.helper.DatabaseTable getViewTable()
INTERNAL:

hasViewTable

public boolean hasViewTable()
INTERNAL:

isExpressionBuilder

public boolean isExpressionBuilder()
INTERNAL:
Overrides:
isExpressionBuilder in class Expression

multipleTableCriteria

public Expression multipleTableCriteria()
INTERNAL: Return the expression to join the main table of this node to any auxiliary tables.

normalize

public Expression normalize(oracle.toplink.internal.expressions.ExpressionNormalizer normalizer)
INTERNAL: Normalize the expression into a printable structure. Any joins must be added to form a new root.

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 This assumes that the original expression has only a single builder.
Specified by:
rebuildOn in class Expression
See Also:
Expression.cloneUsing(Expression newBase)

setQueryClass

public void setQueryClass(java.lang.Class queryClass)
INTERNAL: Set the class which this node represents.

setSession

public void setSession(oracle.toplink.publicinterface.Session session)
INTERNAL: Set the session in which we expect this expression to be translated.

setStatement

public void setStatement(oracle.toplink.internal.expressions.SQLSelectStatement statement)
INTERNAL: Set the statement that expression is for. This is used for the context in subselects.

setViewTable

public void setViewTable(oracle.toplink.internal.helper.DatabaseTable theTable)
INTERNAL: This expression represents something read through a view table.

twistedForBaseAndContext

public Expression twistedForBaseAndContext(Expression newBase,
Expression context)
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

writeDescriptionOn

public void writeDescriptionOn(java.io.BufferedWriter writer)
                        throws java.io.IOException
INTERNAL: For debug printing purposes.
Overrides:
writeDescriptionOn in class Expression
Throws:
java.io.IOException

Copyright © 1998, 2004 Oracle Corporation. All Rights Reserved.