| java.lang.Object java.lang.Runtime org.pnuts.lang.SubtypeGenerator
SubtypeGenerator | public class SubtypeGenerator extends Runtime (Code) | | This class provides a way to extends a Java class in Pnuts.
|
Field Summary | |
final public static int | SUPER | final public static int | THIS |
Method Summary | |
public static void | constructor(ClassFile cf, Class superClass) | public static void | constructor(ClassFile cf, Class superClass, Compiler compiler, Context cc, List assignments) | public static void | defineMethod(ClassFile cf, Class[] parameterTypes, Class returnType, Class[] exceptionTypes, int modifiers, String methodName, String sig, int mode) | static void | defineMethods(ClassFile cf, Package pkg, Class superClass, Class[] interfaces, Context context, int mode, Signature[] signatures) | static void | defineMethods(ClassFile cf, Package pkg, Class superClass, Class[] interfaces, Context context, int mode) | static void | generateGetter(ClassFile cf, String name, Class type, String methodName) | public static Class | generateInterface(String name, Class[] superInterfaces, String[] signatures, Context context) | public static Class | generateInterface(String name, Class[] superInterfaces, String[] signatures, Context context, short modifiers) | static void | generateSetter(ClassFile cf, String name, Class type, String methodName) | public static Class | generateSubclass(Class superClass, Class[] interfaces, Package pkg, Context context, int mode) Generates a class that extends the superClass and implements the
interfaces. | public static Class | generateSubclass(String className, Class superClass, Class[] interfaces, Package pkg, Context context, int mode) Generates a class that extends the superClass and implements the
interfaces. | public static Class | generateSubclass(String className, Class superClass, Class[] interfaces, Signature[] sigs, Package pkg, Context context, int mode) Generates a class that extends the superClass and implements the
interfaces. | public static Class | generateSubclass(String className, Class superClass, Class[] interfaces, Signature[] sigs, Package pkg, Map typeMap, Context context, int mode) | public static ClassFile | getClassFileForInterface(String name, Class[] superInterfaces, String[] signatures, Context context, short modifiers) | public static ClassFile | getClassFileForSubclass(String className, Class superClass, Class[] interfaces, Package pkg, Context context, int mode) Creates a class file image of a subtype of superClass (or some
interfaces) and writes to the output stream. | public static ClassFile | getClassFileForSubclass(String className, Class superClass, Class[] interfaces, Package pkg, Map typeMap, Context context, int mode, Signature[] signatures) Creates a class file image of a subtype of superClass (or some
interfaces) and writes to the output stream. | public static Object | instantiateSubtype(Context context, Class superClass, Class[] interfaces, Package pkg, Object[] args) Generates a subtype of the specified class and instantiates with the
given arguments. | public static ClassLoader | mergeClassLoader(Class[] types, ClassLoader loader) | static int | parseTypes(String sig, Context context, List types) | static List | returnTypeAndExceptions(String sig, Context context) |
SUPER | final public static int SUPER(Code) | | |
THIS | final public static int THIS(Code) | | |
SubtypeGenerator | protected SubtypeGenerator()(Code) | | |
generateInterface | public static Class generateInterface(String name, Class[] superInterfaces, String[] signatures, Context context)(Code) | | Generates an interface
Parameters: name - the name of the interface Parameters: superInterfaces - an array of super interface Parameters: signatures - an array of method signatures Parameters: context - the context in which the classes are loaded the generated interface |
generateInterface | public static Class generateInterface(String name, Class[] superInterfaces, String[] signatures, Context context, short modifiers)(Code) | | Generates an interface
Parameters: name - the name of the interface Parameters: superInterfaces - an array of super interface Parameters: signatures - an array of method signatures Parameters: context - the context in which the classes are loaded Parameters: modifiers - the modifiers of the interface the generated interface |
generateSubclass | public static Class generateSubclass(Class superClass, Class[] interfaces, Package pkg, Context context, int mode)(Code) | | Generates a class that extends the superClass and implements the
interfaces. Functions in the pkg are mapped to non-final/static
public/protected methods with the same name and the same number of
parameters. Note that this method may throw ClassFormatError.
Parameters: superClass - super class that the generated class extends Parameters: interfaces - list of interfaces that the generated class implements Parameters: pkg - a Package that includes functions to be mapped to methods. Parameters: context - a Context in which functions are extracted from pkg Parameters: mode - THIS if each function has 'this' parameter, otherwise 0. the generated class |
generateSubclass | public static Class generateSubclass(String className, Class superClass, Class[] interfaces, Package pkg, Context context, int mode)(Code) | | Generates a class that extends the superClass and implements the
interfaces. Functions in the pkg are mapped to non-final/static
public/protected methods with the same name and the same number of
parameters. Note that this method may throw ClassFormatError.
Parameters: className - the name of the class to be generated Parameters: superClass - super class that the generated class extends Parameters: interfaces - list of interfaces that the generated class implements Parameters: pkg - a Package that includes functions to be mapped to methods. Parameters: context - a Context in which functions are extracted from pkg Parameters: mode - THIS if each function has 'this' parameter, otherwise 0. the generated class |
generateSubclass | public static Class generateSubclass(String className, Class superClass, Class[] interfaces, Signature[] sigs, Package pkg, Context context, int mode)(Code) | | Generates a class that extends the superClass and implements the
interfaces. Functions in the pkg are mapped to non-final/static
public/protected methods with the same name and the same number of
parameters. Note that this method may throw ClassFormatError.
Parameters: className - the name of the class to be generated Parameters: superClass - super class that the generated class extends Parameters: interfaces - list of interfaces that the generated class implements Parameters: sigs - an array of optional explicit method signature.If it is null, method signatures are determined bysupertypes' method signature and number of function parameters.If it isn't null, the array of method signatureis used to determin method signatures. Parameters: pkg - a Package that includes functions to be mapped to methods. Parameters: context - a Context in which functions are extracted from pkg Parameters: mode - THIS if each function has 'this' parameter, otherwise 0. the generated class |
getClassFileForSubclass | public static ClassFile getClassFileForSubclass(String className, Class superClass, Class[] interfaces, Package pkg, Context context, int mode)(Code) | | Creates a class file image of a subtype of superClass (or some
interfaces) and writes to the output stream.
Parameters: superClass - super class that the generated class extends Parameters: interfaces - list of interfaces that the generated class implements Parameters: pkg - a Package that includes functions to be mapped to methods. Parameters: context - a Context in which functions are extracted from pkg Parameters: mode - THIS if each function has 'this' parameter, otherwise 0. |
getClassFileForSubclass | public static ClassFile getClassFileForSubclass(String className, Class superClass, Class[] interfaces, Package pkg, Map typeMap, Context context, int mode, Signature[] signatures)(Code) | | Creates a class file image of a subtype of superClass (or some
interfaces) and writes to the output stream.
Parameters: superClass - super class that the generated class extends Parameters: interfaces - list of interfaces that the generated class implements Parameters: pkg - a Package that includes functions to be mapped to methods. Parameters: context - a Context in which functions are extracted from pkg Parameters: mode - THIS if each function has 'this' parameter, otherwise 0. Parameters: signatures - signature information |
instantiateSubtype | public static Object instantiateSubtype(Context context, Class superClass, Class[] interfaces, Package pkg, Object[] args)(Code) | | Generates a subtype of the specified class and instantiates with the
given arguments.
Parameters: context - the context Parameters: superClass - the super class to extend Parameters: interfaces - the interfaces to implement Parameters: pkg - a Package that includes functions to be mapped to methods. Parameters: args - the arguments to the constructor |
|
|