|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.dynamicjava.interpreter.BaseContext
public class BaseContext
A non-delegating context to place and the top of a delegation chain. All methods return null, false, or an empty list, or (where none of these are valid) throw an UnsupportedOperationException.
| Field Summary | |
|---|---|
static BaseContext |
INSTANCE
|
| Method Summary | |
|---|---|
Access.Module |
accessModule()
Get the current access module. |
boolean |
fieldExists(String name,
TypeSystem ts)
Test whether name is an in-scope field |
boolean |
functionExists(String name,
TypeSystem ts)
Test whether name is an in-scope method or local function |
ClassLoader |
getClassLoader()
Return the class loader for the current scope. |
Iterable<Type> |
getDeclaredThrownTypes()
The types that are allowed to be thrown in the current context. |
Iterable<LocalFunction> |
getLocalFunctions(String name,
TypeSystem ts)
List all local functions that match the given name (empty if there are none) |
Iterable<LocalFunction> |
getLocalFunctions(String name,
TypeSystem ts,
Iterable<LocalFunction> partial)
Helper for getLocalFunctions: list all matching functions, including those provided. |
LocalVariable |
getLocalVariable(String name,
TypeSystem ts)
Return the variable object for the given name, or null if it does not exist. |
Type |
getReturnType()
The expected type of a return statement in the given context, or null
if return statements should not appear here. |
DJClass |
getThis()
Return the class of this in the current context, or null
if there is no such value (for example, in a static context). |
DJClass |
getThis(String className)
Return the class of className.this in the current context, or null
if there is no such value (for example, in a static context). |
DJClass |
getThis(Type expected,
TypeSystem ts)
Return the innermost "this" class with the given type in the current context, or null if there is no such value (for example, in a static context). |
DJClass |
getTopLevelClass(String name,
TypeSystem ts)
Return the top-level class with the given name, or null if it does not exist. |
VariableType |
getTypeVariable(String name,
TypeSystem ts)
Return the type variable with the given name, or null if it does not exist. |
TypeContext |
importField(DJClass c,
String name)
Import the field(s) of c with the given name |
TypeContext |
importMemberClass(DJClass outer,
String name)
Import the member class(es) of outer with the given name |
TypeContext |
importMemberClasses(DJClass outer)
Import on demand all member classes of the given class |
TypeContext |
importMethod(DJClass c,
String name)
Import the method(s) of c with the given name |
TypeContext |
importStaticMembers(DJClass c)
Import on demand all static members of the given class |
TypeContext |
importTopLevelClass(DJClass c)
Import the given top-level class |
TypeContext |
importTopLevelClasses(String pkg)
Import on demand all top-level classes in the given package |
DJClass |
initializingClass()
Class which is being initialized (via a constructor or initialization block); null otherwise. |
boolean |
localFunctionExists(String name,
TypeSystem ts)
Test whether name is an in-scope local function |
boolean |
localVariableExists(String name,
TypeSystem ts)
Test whether name is an in-scope local variable |
String |
makeAnonymousClassName()
Return a full name for an anonymous class declared here. |
String |
makeClassName(String n)
Return a full name for a class with the given name declared here. |
boolean |
memberClassExists(String name,
TypeSystem ts)
Test whether name is an in-scope member class |
boolean |
methodExists(String name,
TypeSystem ts)
Test whether name is an in-scope method |
TypeContext |
setPackage(String name)
Set the current package to the given package name |
boolean |
topLevelClassExists(String name,
TypeSystem ts)
Test whether name is an in-scope top-level class |
ClassType |
typeContainingField(String name,
TypeSystem ts)
Return the most inner type containing a field with the given name, or null
if there is no such type. |
ClassType |
typeContainingMemberClass(String name,
TypeSystem ts)
Return the most inner type containing a class with the given name, or null
if there is no such type. |
Type |
typeContainingMethod(String name,
TypeSystem ts)
Return the most inner type containing a method with the given name, or null
if there is no such type. |
boolean |
typeExists(String name,
TypeSystem ts)
Test whether name is an in-scope top-level class, member class, or type variable |
boolean |
typeVariableExists(String name,
TypeSystem ts)
Test whether name is an in-scope type variable. |
boolean |
variableExists(String name,
TypeSystem ts)
Test whether name is an in-scope field or local variable |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final BaseContext INSTANCE
| Method Detail |
|---|
public boolean fieldExists(String name,
TypeSystem ts)
TypeContextname is an in-scope field
fieldExists in interface TypeContext
public boolean functionExists(String name,
TypeSystem ts)
TypeContextname is an in-scope method or local function
functionExists in interface TypeContextpublic ClassLoader getClassLoader()
TypeContext
getClassLoader in interface TypeContextpublic Iterable<Type> getDeclaredThrownTypes()
TypeContext
getDeclaredThrownTypes in interface TypeContext
public Iterable<LocalFunction> getLocalFunctions(String name,
TypeSystem ts)
TypeContext
getLocalFunctions in interface TypeContext
public Iterable<LocalFunction> getLocalFunctions(String name,
TypeSystem ts,
Iterable<LocalFunction> partial)
TypeContext
getLocalFunctions in interface TypeContext
public LocalVariable getLocalVariable(String name,
TypeSystem ts)
TypeContextnull if it does not exist.
getLocalVariable in interface TypeContextpublic Access.Module accessModule()
TypeContext
accessModule in interface TypeContextpublic Type getReturnType()
TypeContextreturn statement in the given context, or null
if return statements should not appear here.
getReturnType in interface TypeContextpublic DJClass getThis()
TypeContextthis in the current context, or null
if there is no such value (for example, in a static context).
getThis in interface TypeContextpublic DJClass getThis(String className)
TypeContextclassName.this in the current context, or null
if there is no such value (for example, in a static context).
getThis in interface TypeContext
public DJClass getThis(Type expected,
TypeSystem ts)
TypeContextnull if there is no such value (for example, in a static context).
getThis in interface TypeContext
public DJClass getTopLevelClass(String name,
TypeSystem ts)
throws AmbiguousNameException
TypeContextnull if it does not exist.
getTopLevelClass in interface TypeContextAmbiguousNameException
public VariableType getTypeVariable(String name,
TypeSystem ts)
TypeContextnull if it does not exist.
getTypeVariable in interface TypeContext
public TypeContext importField(DJClass c,
String name)
TypeContextc with the given name
importField in interface TypeContext
public TypeContext importMemberClass(DJClass outer,
String name)
TypeContextouter with the given name
importMemberClass in interface TypeContextpublic TypeContext importMemberClasses(DJClass outer)
TypeContext
importMemberClasses in interface TypeContext
public TypeContext importMethod(DJClass c,
String name)
TypeContextc with the given name
importMethod in interface TypeContextpublic TypeContext importStaticMembers(DJClass c)
TypeContext
importStaticMembers in interface TypeContextpublic TypeContext importTopLevelClass(DJClass c)
TypeContext
importTopLevelClass in interface TypeContextpublic TypeContext importTopLevelClasses(String pkg)
TypeContext
importTopLevelClasses in interface TypeContextpublic DJClass initializingClass()
TypeContextnull otherwise.
initializingClass in interface TypeContext
public boolean localFunctionExists(String name,
TypeSystem ts)
TypeContextname is an in-scope local function
localFunctionExists in interface TypeContext
public boolean localVariableExists(String name,
TypeSystem ts)
TypeContextname is an in-scope local variable
localVariableExists in interface TypeContextpublic String makeAnonymousClassName()
TypeContext
makeAnonymousClassName in interface TypeContextpublic String makeClassName(String n)
TypeContext
makeClassName in interface TypeContext
public boolean memberClassExists(String name,
TypeSystem ts)
TypeContextname is an in-scope member class
memberClassExists in interface TypeContext
public boolean methodExists(String name,
TypeSystem ts)
TypeContextname is an in-scope method
methodExists in interface TypeContextpublic TypeContext setPackage(String name)
TypeContext
setPackage in interface TypeContext
public boolean topLevelClassExists(String name,
TypeSystem ts)
TypeContextname is an in-scope top-level class
topLevelClassExists in interface TypeContext
public ClassType typeContainingField(String name,
TypeSystem ts)
throws AmbiguousNameException
TypeContextnull
if there is no such type.
typeContainingField in interface TypeContextAmbiguousNameException
public ClassType typeContainingMemberClass(String name,
TypeSystem ts)
throws AmbiguousNameException
TypeContextnull
if there is no such type.
typeContainingMemberClass in interface TypeContextAmbiguousNameException
public Type typeContainingMethod(String name,
TypeSystem ts)
TypeContextnull
if there is no such type.
typeContainingMethod in interface TypeContext
public boolean typeExists(String name,
TypeSystem ts)
TypeContextname is an in-scope top-level class, member class, or type variable
typeExists in interface TypeContext
public boolean typeVariableExists(String name,
TypeSystem ts)
TypeContextname is an in-scope type variable.
typeVariableExists in interface TypeContext
public boolean variableExists(String name,
TypeSystem ts)
TypeContextname is an in-scope field or local variable
variableExists in interface TypeContext
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||