|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectkoala.dynamicjava.interpreter.context.VariableContext
koala.dynamicjava.interpreter.context.GlobalContext
A global context.
| Nested Class Summary | |
protected class |
GlobalContext.PseudoClassLoader
To test the existance of a class without loading it |
protected class |
GlobalContext.PseudoError
To test the existance of a class without loading it |
| Nested classes inherited from class koala.dynamicjava.interpreter.context.VariableContext |
VariableContext.AbstractVariable, VariableContext.Constant, VariableContext.Link, VariableContext.LinkFactory, VariableContext.Scope, VariableContext.Variable |
| Field Summary | |
protected boolean |
accessible
|
protected static ReferenceType |
CLASS_TYPE
|
protected static int |
classCount
To generate an unique name for the generated classes |
protected java.lang.ClassLoader |
classLoader
The class loader |
protected ClassLoaderContainer |
clc
The class loader container |
protected java.util.List |
functions
The functions |
protected ImportationManager |
importationManager
The importation manager |
protected Interpreter |
interpreter
The interpreter |
protected static FieldDeclaration |
LOCALS
|
protected static java.lang.String |
LOCALS_NAME
|
protected static ReferenceType |
MAP_TYPE
|
protected static ArrayType |
OBJECT_ARRAY_ARRAY
|
protected static TypeExpression |
OBJECT_CLASS
|
protected static ReferenceType |
OBJECT_TYPE
|
| Fields inherited from class koala.dynamicjava.interpreter.context.VariableContext |
cscope, scope, scopes |
| Constructor Summary | |
GlobalContext(Interpreter i)
Creates a new context |
|
GlobalContext(Interpreter i,
java.lang.ClassLoader cl)
Creates a new context |
|
GlobalContext(Interpreter i,
java.util.Set entries)
Creates a new context initialized with the given entries defined in the initial scope. |
|
| Method Summary | |
boolean |
classExists(java.lang.String name)
Whether a simple identifier is a class |
protected ArrayInitializer |
createClassArrayInitializer()
Creates an initializer for the variable class array used to implement inner classes |
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 or type in this context. |
boolean |
getAccessible()
Returns the accessibility state of this context. |
protected java.lang.ClassLoader |
getAdditionalClassLoader()
Gets the additional class loader |
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 |
protected java.lang.String |
getPackageName(java.lang.Class c)
Gets the package name for the given class |
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 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 |
protected void |
setAccessFlag(java.lang.reflect.Member m)
Sets the access flag of a member |
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[] cargs)
Sets the properties of a SimpleAllocation node |
| Methods inherited from class koala.dynamicjava.interpreter.context.VariableContext |
define, defineConstant, defineVariables, enterScope, enterScope, get, getConstants, getCurrentScopeVariableNames, getCurrentScopeVariables, isDefinedVariable, isFinal, leaveScope, set, setConstant, setVariable |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface koala.dynamicjava.interpreter.context.SimpleContext |
define, defineConstant, defineVariables, enterScope, enterScope, get, getConstants, getCurrentScopeVariableNames, getCurrentScopeVariables, isDefinedVariable, isFinal, leaveScope, set, setConstant, setVariable |
| Field Detail |
protected static final ReferenceType CLASS_TYPE
protected static final ReferenceType MAP_TYPE
protected static final ReferenceType OBJECT_TYPE
protected static final ArrayType OBJECT_ARRAY_ARRAY
protected static final TypeExpression OBJECT_CLASS
protected static final java.lang.String LOCALS_NAME
protected static final FieldDeclaration LOCALS
protected static int classCount
protected ImportationManager importationManager
protected Interpreter interpreter
protected java.lang.ClassLoader classLoader
protected ClassLoaderContainer clc
protected java.util.List functions
protected boolean accessible
| Constructor Detail |
public GlobalContext(Interpreter i)
i - the interpreter
public GlobalContext(Interpreter i,
java.lang.ClassLoader cl)
i - the interpretercl - the classloader to use
public GlobalContext(Interpreter i,
java.util.Set entries)
i - the interpreterentries - a set of string| Method Detail |
public void setAdditionalClassLoaderContainer(ClassLoaderContainer clc)
setAdditionalClassLoaderContainer in interface Contextpublic void setAccessible(boolean accessible)
setAccessible in interface Contextpublic boolean getAccessible()
getAccessible in interface Contextprotected java.lang.ClassLoader getAdditionalClassLoader()
public void setFunctions(java.util.List l)
setFunctions in interface Contextpublic java.util.List getFunctions()
getFunctions in interface Contextpublic Interpreter getInterpreter()
getInterpreter in interface Contextpublic ImportationManager getImportationManager()
getImportationManager in interface Contextpublic void setImportationManager(ImportationManager im)
setImportationManager in interface Contextpublic boolean exists(java.lang.String name)
exists in interface Contextname - the identifierpublic boolean classExists(java.lang.String name)
classExists in interface Contextname - the identifierpublic void defineFunction(MethodDeclaration node)
defineFunction in interface Contextnode - the function declarationpublic void defineClass(TypeDeclaration node)
defineClass in interface Contextnode - the class declarationpublic boolean isDefined(java.lang.String name)
isDefined in interface Contextname - the name of the entry
public void setCurrentPackage(java.lang.String pkg)
setCurrentPackage in interface Contextpkg - the package namepublic java.lang.String getCurrentPackage()
getCurrentPackage in interface Contextpublic void declarePackageImport(java.lang.String pkg)
declarePackageImport in interface Contextpkg - the package name
public void declareClassImport(java.lang.String cname)
throws java.lang.ClassNotFoundException
declareClassImport in interface Contextcname - the fully qualified class name
java.lang.ClassNotFoundException - if the class cannot be foundpublic Node getDefaultQualifier(Node node)
getDefaultQualifier in interface Contextnode - the current node
public Node getDefaultQualifier(Node node,
java.lang.String tname)
getDefaultQualifier in interface Contextnode - the current nodetname - the qualifier of 'this'public LeftHandSideModifier getModifier(QualifiedName node)
getModifier in interface Contextnode - a tree nodepublic LeftHandSideModifier getModifier(ObjectFieldAccess node)
getModifier in interface Contextnode - a tree nodepublic LeftHandSideModifier getModifier(StaticFieldAccess node)
getModifier in interface Contextnode - a tree nodepublic LeftHandSideModifier getModifier(SuperFieldAccess node)
getModifier in interface Contextnode - a tree nodepublic java.lang.Object getHiddenArgument()
getHiddenArgument in interface Context
public Expression createName(Node node,
IdentifierToken name)
createName in interface Contextnode - the current nodename - the variable name
java.lang.IllegalStateException - if the variable is not defined
public java.lang.Class lookupClass(java.lang.String cname)
throws java.lang.ClassNotFoundException
lookupClass in interface Contextcname - the class name
java.lang.ClassNotFoundException - if the class cannot be found
public java.lang.Class lookupClass(java.lang.String cname,
java.lang.String ccname)
throws java.lang.ClassNotFoundException
lookupClass in interface Contextcname - the class nameccname - the fully qualified name of the context class
java.lang.ClassNotFoundException - if the class cannot be found
public java.lang.Class setProperties(SimpleAllocation node,
java.lang.Class c,
java.lang.Class[] cargs)
setProperties in interface Contextnode - the allocation nodec - the class of the constructorcargs - the classes of the arguments of the constructor
public java.lang.Class setProperties(ClassAllocation node,
java.lang.Class c,
java.lang.Class[] args,
java.util.List memb)
setProperties in interface Contextnode - the allocation nodec - the class of the constructorargs - the classes of the arguments of the constructormemb - the class membersprotected ArrayInitializer createClassArrayInitializer()
public java.lang.reflect.Constructor lookupConstructor(java.lang.Class c,
java.lang.Class[] params)
throws java.lang.NoSuchMethodException
lookupConstructor in interface Contextc - the class of the constructorparams - the parameter types
java.lang.NoSuchMethodException - if the constructor cannot be found
public java.lang.Object invokeConstructor(SimpleAllocation node,
java.lang.Object[] args)
invokeConstructor in interface Contextnode - the SimpleAllocation nodeargs - the arguments
public java.lang.Object invokeConstructor(ClassAllocation node,
java.lang.Object[] args)
invokeConstructor in interface Contextnode - the ClassAllocation nodeargs - the arguments
public java.lang.reflect.Method lookupMethod(Node prefix,
java.lang.String mname,
java.lang.Class[] params)
throws java.lang.NoSuchMethodException
lookupMethod in interface Contextprefix - the method prefixmname - the method nameparams - the parameter types
java.lang.NoSuchMethodException - if the method cannot be found
public MethodDeclaration lookupFunction(java.lang.String mname,
java.lang.Class[] params)
throws NoSuchFunctionException
lookupFunction in interface Contextmname - the function nameparams - the parameter types
NoSuchFunctionException - if the function cannot be found
public java.lang.reflect.Method lookupSuperMethod(Node node,
java.lang.String mname,
java.lang.Class[] params)
throws java.lang.NoSuchMethodException
lookupSuperMethod in interface Contextnode - the current nodemname - the method nameparams - the parameter types
java.lang.NoSuchMethodException - if the method cannot be find
public java.lang.reflect.Field getField(java.lang.Class fc,
java.lang.String fn)
throws java.lang.NoSuchFieldException,
AmbiguousFieldException
getField in interface Contextfc - the field classfn - the field name
java.lang.NoSuchFieldException - if the field cannot be find
AmbiguousFieldException - if the field is ambiguous
public java.lang.reflect.Field getSuperField(Node node,
java.lang.String fn)
throws java.lang.NoSuchFieldException,
AmbiguousFieldException
getSuperField in interface Contextnode - the current nodefn - the field name
java.lang.NoSuchFieldException - if the field cannot be find
AmbiguousFieldException - if the field is ambiguousprotected void setAccessFlag(java.lang.reflect.Member m)
protected java.lang.String getPackageName(java.lang.Class c)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||