|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The classes that implements this interface represent contexts of execution
Method Summary | |
boolean |
classExists(java.lang.String name)
Whether a simple identifier is a class |
Expression |
createName(Node node,
IdentifierToken name)
Creates the tree that is associated with the given name |
void |
declareClassImport(java.lang.String cname)
Declares a new single-type-import clause |
void |
declarePackageImport(java.lang.String pkg)
Declares a new import-on-demand clause |
void |
defineClass(TypeDeclaration node)
Defines a class from its syntax tree |
void |
defineFunction(MethodDeclaration node)
Defines a MethodDeclaration as a function |
boolean |
exists(java.lang.String name)
Whether a simple identifier represents an existing variable or field in this context |
boolean |
getAccessible()
Returns the accessibility state of this context. |
java.lang.String |
getCurrentPackage()
Returns the current package |
Node |
getDefaultQualifier(Node node)
Returns the default qualifier for this context |
Node |
getDefaultQualifier(Node node,
java.lang.String tname)
Returns the default qualifier for this context |
java.lang.reflect.Field |
getField(java.lang.Class fc,
java.lang.String fn)
Looks for a field |
java.util.List |
getFunctions()
Returns the defined functions |
java.lang.Object |
getHiddenArgument()
Returns the default argument to pass to methods in this context |
ImportationManager |
getImportationManager()
Returns the importation manager |
Interpreter |
getInterpreter()
Returns the current interpreter |
LeftHandSideModifier |
getModifier(ObjectFieldAccess node)
Returns the modifier that match the given node |
LeftHandSideModifier |
getModifier(QualifiedName node)
Returns the modifier that match the given node |
LeftHandSideModifier |
getModifier(StaticFieldAccess node)
Returns the modifier that match the given node |
LeftHandSideModifier |
getModifier(SuperFieldAccess node)
Returns the modifier that match the given node |
java.lang.reflect.Field |
getSuperField(Node node,
java.lang.String fn)
Looks for a field in the super class |
java.lang.Object |
invokeConstructor(ClassAllocation node,
java.lang.Object[] args)
Invokes a constructor |
java.lang.Object |
invokeConstructor(SimpleAllocation node,
java.lang.Object[] args)
Invokes a constructor |
boolean |
isDefined(java.lang.String name)
Tests whether a variable or a field is defined in this context |
java.lang.Class |
lookupClass(java.lang.String cname)
Looks for a class |
java.lang.Class |
lookupClass(java.lang.String cname,
java.lang.String ccname)
Looks for a class (context-free lookup) |
java.lang.reflect.Constructor |
lookupConstructor(java.lang.Class c,
java.lang.Class[] params)
Looks for a constructor |
MethodDeclaration |
lookupFunction(java.lang.String mname,
java.lang.Class[] params)
Looks for a function |
java.lang.reflect.Method |
lookupMethod(Node prefix,
java.lang.String mname,
java.lang.Class[] params)
Looks for a method |
java.lang.reflect.Method |
lookupSuperMethod(Node node,
java.lang.String mname,
java.lang.Class[] params)
Looks for a super method |
void |
setAccessible(boolean accessible)
Allows the scripts to access private fields. |
void |
setAdditionalClassLoaderContainer(ClassLoaderContainer clc)
Sets the additional class loader container |
void |
setCurrentPackage(java.lang.String pkg)
Sets the current package |
void |
setFunctions(java.util.List l)
Sets the defined functions |
void |
setImportationManager(ImportationManager im)
Sets the importation manager |
java.lang.Class |
setProperties(ClassAllocation node,
java.lang.Class c,
java.lang.Class[] args,
java.util.List memb)
Sets the properties of a ClassAllocation node |
java.lang.Class |
setProperties(SimpleAllocation node,
java.lang.Class c,
java.lang.Class[] args)
Sets the properties of a SimpleAllocation node |
Methods inherited from interface koala.dynamicjava.interpreter.context.SimpleContext |
define, defineConstant, defineVariables, enterScope, enterScope, get, getConstants, getCurrentScopeVariableNames, getCurrentScopeVariables, isDefinedVariable, isFinal, leaveScope, set, setConstant, setVariable |
Method Detail |
public void setAdditionalClassLoaderContainer(ClassLoaderContainer clc)
public void setAccessible(boolean accessible)
public boolean getAccessible()
public void setFunctions(java.util.List l)
public java.util.List getFunctions()
public Interpreter getInterpreter()
public ImportationManager getImportationManager()
public void setImportationManager(ImportationManager im)
public boolean exists(java.lang.String name)
name
- the identifierpublic boolean classExists(java.lang.String name)
name
- the identifierpublic boolean isDefined(java.lang.String name)
name
- the name of the entry
public void setCurrentPackage(java.lang.String pkg)
pkg
- the package namepublic java.lang.String getCurrentPackage()
public void declarePackageImport(java.lang.String pkg)
pkg
- the package namepublic void declareClassImport(java.lang.String cname) throws java.lang.ClassNotFoundException
cname
- the fully qualified class name
java.lang.ClassNotFoundException
- if the class cannot be foundpublic Node getDefaultQualifier(Node node)
node
- the current nodepublic Node getDefaultQualifier(Node node, java.lang.String tname)
node
- the current nodetname
- the qualifier of 'this'public LeftHandSideModifier getModifier(QualifiedName node)
node
- a tree nodepublic LeftHandSideModifier getModifier(StaticFieldAccess node)
node
- a tree nodepublic LeftHandSideModifier getModifier(ObjectFieldAccess node)
node
- a tree nodepublic LeftHandSideModifier getModifier(SuperFieldAccess node)
node
- a tree nodepublic java.lang.Object getHiddenArgument()
public Expression createName(Node node, IdentifierToken name)
node
- the current nodename
- the variable name
java.lang.IllegalStateException
- if the variable is not definedpublic void defineFunction(MethodDeclaration node)
node
- the function declarationpublic void defineClass(TypeDeclaration node)
node
- the class declarationpublic java.lang.Class lookupClass(java.lang.String cname) throws java.lang.ClassNotFoundException
cname
- the class name
java.lang.ClassNotFoundException
- if the class cannot be foundpublic java.lang.Class lookupClass(java.lang.String cname, java.lang.String ccname) throws java.lang.ClassNotFoundException
cname
- the class nameccname
- the fully qualified name of the context class
java.lang.ClassNotFoundException
- if the class cannot be foundpublic java.lang.Class setProperties(SimpleAllocation node, java.lang.Class c, java.lang.Class[] args)
node
- the allocation nodec
- the class of the constructorargs
- the classes of the arguments of the constructorpublic java.lang.Class setProperties(ClassAllocation node, java.lang.Class c, java.lang.Class[] args, java.util.List memb)
node
- the allocation nodec
- the class of the constructorargs
- the classes of the arguments of the constructormemb
- the class memberspublic java.lang.reflect.Constructor lookupConstructor(java.lang.Class c, java.lang.Class[] params) throws java.lang.NoSuchMethodException
c
- the class of the constructorparams
- the parameter types
java.lang.NoSuchMethodException
- if the constructor cannot be foundpublic java.lang.Object invokeConstructor(SimpleAllocation node, java.lang.Object[] args)
node
- the SimpleAllocation nodeargs
- the argumentspublic java.lang.Object invokeConstructor(ClassAllocation node, java.lang.Object[] args)
node
- the ClassAllocation nodeargs
- the argumentspublic java.lang.reflect.Method lookupMethod(Node prefix, java.lang.String mname, java.lang.Class[] params) throws java.lang.NoSuchMethodException
prefix
- the method prefixmname
- the method nameparams
- the parameter types
java.lang.NoSuchMethodException
- if the method cannot be foundpublic MethodDeclaration lookupFunction(java.lang.String mname, java.lang.Class[] params) throws NoSuchFunctionException
mname
- the function nameparams
- the parameter types
NoSuchFunctionException
- if the function cannot be foundpublic java.lang.reflect.Method lookupSuperMethod(Node node, java.lang.String mname, java.lang.Class[] params) throws java.lang.NoSuchMethodException
node
- the current nodemname
- the method nameparams
- the parameter types
java.lang.NoSuchMethodException
- if the method cannot be foundpublic java.lang.reflect.Field getField(java.lang.Class fc, java.lang.String fn) throws java.lang.NoSuchFieldException, AmbiguousFieldException
fc
- the field classfn
- the field name
java.lang.NoSuchFieldException
- if the field cannot be found
AmbiguousFieldException
- if the field is ambiguouspublic java.lang.reflect.Field getSuperField(Node node, java.lang.String fn) throws java.lang.NoSuchFieldException, AmbiguousFieldException
node
- the current nodefn
- the field name
java.lang.NoSuchFieldException
- if the field cannot be found
AmbiguousFieldException
- if the field is ambiguous
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |