|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eigenbase.oj.util.OJUtil
public abstract class OJUtil
Static utilities for manipulating OpenJava expressions.
Nested Class Summary | |
---|---|
static class |
OJUtil.StopIterationException
A StopIterationException is a way to tell a ParseTreeVisitor to halt traversal of the tree, but
is not regarded as an error. |
Constructor Summary | |
---|---|
OJUtil()
|
Method Summary | |
---|---|
static Expression |
box(OJClass clazz,
Expression exp)
Ensures that an expression is an object. |
static int |
countParseTreeNodes(ParseTree parseTree)
Counts the number of nodes in a parse tree. |
static GlobalEnvironment |
getGlobalEnvironment(Environment env)
Gets the root environment, which is always a GlobalEnvironment . |
static OJClass |
getType(Environment env,
Expression exp)
|
static Expression |
go(ParseTreeVisitor visitor,
Expression p)
Sets a ParseTreeVisitor going on a given non-relational
expression, and returns the result. |
static ParseTree |
go(ParseTreeVisitor visitor,
ParseTree p)
Sets a ParseTreeVisitor going on a parse tree, and returns the
result. |
static OJClass |
guessRowType(OJClass clazz)
Guesses the row-type of an expression which has type clazz . |
static Object |
literalValue(Literal literal)
|
static RelDataType |
ojToType(RelDataTypeFactory typeFactory,
OJClass ojClass)
|
static void |
recordMemberClass(Environment env,
String declarerName,
String innerName)
If env is a ClassEnvironment for declarerName, records new inner
class innerName; otherwise, delegates up the environment hierarchy. |
static String |
replaceDotWithDollar(String base,
int i)
|
static void |
setThreadTypeFactory(OJTypeFactory typeFactory)
|
static OJTypeFactory |
threadTypeFactory()
|
static TypeName |
toTypeName(RelDataType rowType,
RelDataTypeFactory typeFactory)
Converts a RelDataType to a TypeName . |
static TypeName |
typeNameForClass(Class clazz)
|
static OJClass |
typeToOJClass(OJClass declarer,
RelDataType rowType,
RelDataTypeFactory typeFactory)
|
static OJClass |
typeToOJClass(RelDataType rowType,
RelDataTypeFactory typeFactory)
Converts a RelDataType to a OJClass . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final OJClass clazzVoid
public static final OJClass clazzObject
public static final OJClass clazzObjectArray
public static final OJClass clazzCollection
public static final OJClass clazzMap
public static final OJClass clazzMapEntry
public static final OJClass clazzHashtable
public static final OJClass clazzEnumeration
public static final OJClass clazzIterator
public static final OJClass clazzIterable
public static final OJClass clazzTupleIter
public static final OJClass clazzVector
public static final OJClass clazzComparable
public static final OJClass clazzComparator
public static final OJClass clazzResultSet
public static final OJClass clazzClass
public static final OJClass clazzString
public static final OJClass clazzSet
public static final OJClass clazzSQLException
public static final OJClass clazzEntry
public static final OJClass[] emptyArrayOfOJClass
public static final ModifierList modFinal
public static final OJClass clazzInteger
public static final TypeName tnInt
public static final OJClass clazzList
public static final TypeName tnList
public static final OJClass clazzArrays
public static final TypeName tnArrays
public static final TypeName tnObject
public static final OJClass clazzRestartableIterator
public static TypeName tnRestartableIterator
public static final ThreadLocal<OJClass> threadDeclarers
OJClass
. Synthetic classes are declared
as inner classes of this.
private static final ThreadLocal<OJTypeFactory> threadTypeFactories
Constructor Detail |
---|
public OJUtil()
Method Detail |
---|
public static void setThreadTypeFactory(OJTypeFactory typeFactory)
public static OJTypeFactory threadTypeFactory()
public static RelDataType ojToType(RelDataTypeFactory typeFactory, OJClass ojClass)
public static TypeName toTypeName(RelDataType rowType, RelDataTypeFactory typeFactory)
RelDataType
to a TypeName
.
public static OJClass typeToOJClass(OJClass declarer, RelDataType rowType, RelDataTypeFactory typeFactory)
public static OJClass typeToOJClass(RelDataType rowType, RelDataTypeFactory typeFactory)
RelDataType
to a OJClass
.
public static Object literalValue(Literal literal)
public static TypeName typeNameForClass(Class clazz)
public static String replaceDotWithDollar(String base, int i)
public static final OJClass guessRowType(OJClass clazz)
clazz
.
For example, String
[] --> String
; Iterator
--> Object
.
public static ParseTree go(ParseTreeVisitor visitor, ParseTree p)
ParseTreeVisitor
going on a parse tree, and returns the
result.
public static Expression go(ParseTreeVisitor visitor, Expression p)
ParseTreeVisitor
going on a given non-relational
expression, and returns the result.
public static Expression box(OJClass clazz, Expression exp)
int
expression
2 + 3
becomes new Integer(2 + 3)
);
non-primitive expressions are unchanged.
exp
- an expressionclazz
- exp
's type
exp
is primitive, exp
otherwisepublic static GlobalEnvironment getGlobalEnvironment(Environment env)
GlobalEnvironment
.
env
- environment to start search frompublic static void recordMemberClass(Environment env, String declarerName, String innerName)
ClassEnvironment
for declarerName, records new inner
class innerName; otherwise, delegates up the environment hierarchy.
env
- environment to start search fromdeclarerName
- fully-qualified name of enclosing classinnerName
- simple name of inner classpublic static OJClass getType(Environment env, Expression exp)
public static int countParseTreeNodes(ParseTree parseTree)
parseTree
- tree to walk
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |