|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--openjava.mop.Environment
Nested Class Summary | |
protected static class |
Environment.BasicVariableInfo
|
static interface |
Environment.VariableInfo
|
Field Summary | |
protected Environment |
parent
|
Constructor Summary | |
Environment()
|
|
Environment(Environment e)
|
Method Summary | |
abstract void |
bindVariable(String name,
Environment.VariableInfo info)
Binds the name of a variable to information about the variable, including its class. |
void |
bindVariable(String name,
OJClass clazz)
Binds the name of a variable to its class. |
String |
currentClassName()
|
ClassEnvironment |
getClassEnvironmentParent()
Gets the nearest ancestor which is a ClassEnvironment , or null. |
GlobalEnvironment |
getGlobalEnvironment()
Gets the root environment, which is always a GlobalEnvironment . |
String |
getPackage()
Gets the package name. |
Environment |
getParent()
Gets the parent environment. |
boolean |
isBind(String name)
Returns whether a name is a variable. |
static boolean |
isQualifiedName(String name)
Tests if the given name is a qualified name or not. |
boolean |
isRegisteredModifier(String str)
|
Environment.VariableInfo |
lookupBind(String name)
Looks up a binded type of the given variable or field name. |
OJClass |
lookupClass(String name)
Looks a class object up. |
OJClass |
lookupClass(String name,
int dimensionCount)
Looks up a class with a given dimension. |
abstract void |
record(String name,
OJClass clazz)
Records a class object. |
void |
recordMemberClass(String declarerName,
String innerName)
If this is a ClassEnvironment for declarerName, record new inner
class innerName; otherwise, pass up the environment hierarchy. |
static String |
toPackageName(String qualified_name)
Converts a fully-qualified name to the corresponding package name. |
String |
toQualifiedName(String name)
Obtains the fully-qualified name of the given class name. |
static String |
toSimpleName(String qualified_name)
Converts a fully-qualified name to the corresponding simple-name. |
abstract String |
toString()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Environment parent
Constructor Detail |
public Environment()
public Environment(Environment e)
Method Detail |
public abstract String toString()
toString
in class Object
public Environment getParent()
public ClassEnvironment getClassEnvironmentParent()
ClassEnvironment
, or null.
public GlobalEnvironment getGlobalEnvironment()
GlobalEnvironment
.
public String getPackage()
public OJClass lookupClass(String name)
name
- the name of the fully-qualified name of
the class looked forpublic OJClass lookupClass(String name, int dimensionCount)
lookupClass("java.lang.String", 2)
returns the OJClass
representing the class String[][]
.
name
- the fully-qualified name of the classdimensionCount
- the dimensionality of the type
public abstract void record(String name, OJClass clazz)
name
- the fully-qualified name of the classclazz
- the class object associated with that namepublic Environment.VariableInfo lookupBind(String name)
name
- the fully-qualified name of the classpublic boolean isBind(String name)
lookupBind(java.lang.String)
, because the tree is not yet in a state where we
can infer types.)
public void bindVariable(String name, OJClass clazz)
name
- the fully-qualified name of the classclazz
- the class object associated with that namepublic abstract void bindVariable(String name, Environment.VariableInfo info)
public String toQualifiedName(String name)
name
- a simple class name or a fully-qualified class name
public static boolean isQualifiedName(String name)
public static String toSimpleName(String qualified_name)
For example : toSimpleName( "java.lang.Class" ) returns "Class".
public static String toPackageName(String qualified_name)
For example : toPackageName( "java.lang.Class" ) returns "java.lang". toPackageName( "MyClass" ) returns "".
public String currentClassName()
public boolean isRegisteredModifier(String str)
public void recordMemberClass(String declarerName, String innerName)
ClassEnvironment
for declarerName, record new inner
class innerName; otherwise, pass up the environment hierarchy.
declarerName
- fully-qualified name of enclosing classinnerName
- simple name of inner class
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |