edu.mit.ai.psg.jeva
Class GenerateProxyClass

java.lang.Object
  |
  +--edu.mit.ai.psg.jeva.GenerateProxyClass

public class GenerateProxyClass
extends Object
implements JevaParserConstants

generateClass(InterpretedClass) generates the proxy class for an interpreted object from the InterpretedClass. The proxy class has the correct signature for the class, but calls the interpreted methods and constructors for all its operations.

Note: if class calls super.methodName(..), then we must add some private methods to implement the super call. The private methods are of the form private TYPE $super$methodName(arg1..){ return super.methodName(arg1..);}

Author:
CarlManning, caroma@ai.mit.edu
Copyright (c) 1999 Massachusetts Institute of Technology

Constructor Summary
GenerateProxyClass()
           
 
Method Summary
static void decache()
          decache classes that have been generated so far this session
static String defaultValueSource(Class storeType)
          generate source code for the default value for a type, e.g., "false" for boolean, "0" for numbers, "null" for non-primitive types
static String defaultValueSource(IClass storeType)
          generate source code for the default value for a type, e.g., "false" for boolean, "0" for numbers, "null" for non-primitive types
static Class generateClass(InterpretedClass iClass)
          Generate proxy class for iClass.
static Set generateCompileSet(InterpretedClass iClass)
          From a verified InterpretedClass C for which a proxy class is to be generated, generate a list of interpreted classes which must also have their proxy classes written out along with C in order for C's proxy class to be compiled.
static String generateSource(InterpretedClass iClass)
          generate compilation unit for a proxy class for iClass
static String unwrapExpressionIfPrimitive(String expr, Class type)
          generate source code to unwrap a value if it is primitive, e.g., ("i", int.class)-->"((Integer)i).intValue()", ("i", Object.class)-->"i"
static String wrapExpressionIfPrimitive(String expr, Class type)
          generate source code to wrap a value if it is primitive, e.g., ("i", int.class) --> "new Integer(i)", ("i", Object.class) --> "i"
static String wrapExpressionIfPrimitive(String expr, IClass type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenerateProxyClass

public GenerateProxyClass()
Method Detail

generateClass

public static Class generateClass(InterpretedClass iClass)
Generate proxy class for iClass.

decache

public static void decache()
decache classes that have been generated so far this session

generateCompileSet

public static Set generateCompileSet(InterpretedClass iClass)
From a verified InterpretedClass C for which a proxy class is to be generated, generate a list of interpreted classes which must also have their proxy classes written out along with C in order for C's proxy class to be compiled. This includes all classes referred to by C's proxy class, which is the same as all classes referred to in C's signature, including superclass, interfaces, method, constructor, and fields type signatures, and throws declarations. It does not include types used within method/constructor bodies or static/object/field initializers, as the generated proxy classes use no additional interpreted types in their body.

generateSource

public static String generateSource(InterpretedClass iClass)
generate compilation unit for a proxy class for iClass

wrapExpressionIfPrimitive

public static String wrapExpressionIfPrimitive(String expr,
                                               Class type)
generate source code to wrap a value if it is primitive, e.g., ("i", int.class) --> "new Integer(i)", ("i", Object.class) --> "i"

wrapExpressionIfPrimitive

public static String wrapExpressionIfPrimitive(String expr,
                                               IClass type)

unwrapExpressionIfPrimitive

public static String unwrapExpressionIfPrimitive(String expr,
                                                 Class type)
generate source code to unwrap a value if it is primitive, e.g., ("i", int.class)-->"((Integer)i).intValue()", ("i", Object.class)-->"i"

defaultValueSource

public static final String defaultValueSource(Class storeType)
generate source code for the default value for a type, e.g., "false" for boolean, "0" for numbers, "null" for non-primitive types

defaultValueSource

public static final String defaultValueSource(IClass storeType)
generate source code for the default value for a type, e.g., "false" for boolean, "0" for numbers, "null" for non-primitive types

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-bugs@ai.mit.edu