wt.tools.generation.language
Class JavaMethodGenerator

java.lang.Object
  extended bywt.tools.generation.language.JavaMethodGenerator
Direct Known Subclasses:
WTMethodGenerator

public class JavaMethodGenerator
extends Object


Field Summary
protected  Operation source
           
protected static JavaMethodGenerator theInstance
           
 
Constructor Summary
JavaMethodGenerator()
           
 
Method Summary
protected  void addReadType(Vector bodyLines, Attribute attribute, String input, String readWriter)
           
protected  void addWriteType(Vector bodyLines, Attribute attribute, String output, String readWriter)
           
protected static String argCheck(String argName, String argType, String fieldType, String operation, String operand, String constant, boolean isPersistent, boolean enforce_varchar_limit)
           
protected  String arguments()
           
protected  String attributeName()
           
protected  void biDirectionalSet(Vector bodyLines)
           
protected  void classInfo(Vector bodyLines)
           
protected  void classname(Vector bodyLines)
           
private  String columnName(Attribute attribute, String prefix, int arrayIndex)
           
protected static String construct(Attribute attribute)
           
protected static String construct(String type)
           
protected static String construct(String type, int arraySize)
           
protected static String construct(String type, String arguments)
           
protected static String constructFactory(String type)
           
protected static String constructFactory(String type, String arguments)
           
protected  void constructor(Vector bodyLines)
           
protected  String containerPlus(Attribute attribute)
           
protected  void create(Vector bodyLines)
           
protected  void defaultBody(Vector bodyLines)
           
protected  String defaultReturn(String type)
           
protected  void delegator(Vector bodyLines)
           
protected  String derivedTraversal()
          Obtain the String that is the code to traverse to the source field for a derived attribute.
protected  void evolvableRead(Vector bodyLines)
           
protected  void evolvableReadProtected(Vector bodyLines)
           
protected  void evolvableWrite(Vector bodyLines)
           
protected  void externalizationRead(Vector bodyLines)
           
protected  void externalizationReadFields(Vector bodyLines, String input, boolean oldFormat)
           
protected  void externalizationWrite(Vector bodyLines)
           
 Vector genBody(Operation theSource)
           
protected  Vector genBody(Vector bodyLines, MethodBody bodyType)
           
protected  void genEquals(Vector bodyLines)
           
protected  void genHashcode(Vector bodyLines)
           
static JavaMethodGenerator get()
           
protected static String getter(String getterName, String type)
          Obtain the String that is the getter for the attribute.
protected  void getter(Vector bodyLines)
           
private  String getterCall(String input, String readWriter, String primitiveWrapper, Attribute attribute)
           
private  String getterCall(String input, String readWriter, String primitiveWrapper, Attribute attribute, int arrayIndex)
           
protected  void getterDerived(Vector bodyLines)
           
protected  void getterKeyed(Vector bodyLines)
           
protected  void getterRBcontents(Vector bodyLines)
           
protected  String identification()
           
protected  void initialize(Vector bodyLines)
           
protected  void instance(Vector bodyLines)
           
protected static String instantiate(Attribute attribute)
           
protected static String instantiate(String type, String arguments)
           
protected  boolean isPDSArray(Attribute attr)
           
protected  String keyArgs()
           
protected  boolean mappableType(String type, Attribute attribute)
           
(package private) static String objectCast(String reader, Attribute attribute)
           
protected  void oldVersionRead(Vector bodyLines)
           
protected  void oldVersionReadTop(Vector bodyLines)
           
protected  void PDSRead(Vector bodyLines)
           
protected  void PDSWrite(Vector bodyLines)
           
protected static String readObject(ClassProperty attribute)
           
protected  String readWriter(Attribute attribute)
           
protected  String readWriterPDS(Attribute attribute)
           
protected  void removerKeyed(Vector bodyLines)
           
protected  String returnCast()
           
protected  String returnNoCast()
           
protected  void setter(Vector bodyLines)
           
private  String setterCall(String output, String readWriter, String primitiveWrapper, Attribute attribute, String primitiveConversion, String objectName)
           
private  String setterCall(String output, String readWriter, String primitiveWrapper, Attribute attribute, String primitiveConversion, String objectName, int arrayIndex)
           
protected  void setterCovariant(Vector bodyLines)
           
protected  void setterDerived(Vector bodyLines)
           
protected  void setterKeyed(Vector bodyLines)
           
protected  void setterValidation(Vector bodyLines)
           
protected static String setterValueName(Operation op)
           
protected static String setterValueType(Operation op)
           
protected  void staticMethod(Vector bodyLines)
           
protected  String superCall()
           
protected static String tab(int howMany)
           
protected  String toPrimitive()
           
protected static String toPrimitive(String primitiveType)
           
protected static String toPrimitive(String primitiveType, String attrName)
           
protected  void toStringDefault(Vector bodyLines)
           
protected  String toWrapper()
           
protected  String toWrapper(String type, String name)
           
protected static String transformArg(ClassProperty attr, String argument)
           
protected static String writeObject(Attribute attribute)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

source

protected Operation source

theInstance

protected static JavaMethodGenerator theInstance
Constructor Detail

JavaMethodGenerator

public JavaMethodGenerator()
Method Detail

getterCall

private String getterCall(String input,
                          String readWriter,
                          String primitiveWrapper,
                          Attribute attribute,
                          int arrayIndex)

getterCall

private String getterCall(String input,
                          String readWriter,
                          String primitiveWrapper,
                          Attribute attribute)

setterCall

private String setterCall(String output,
                          String readWriter,
                          String primitiveWrapper,
                          Attribute attribute,
                          String primitiveConversion,
                          String objectName,
                          int arrayIndex)

setterCall

private String setterCall(String output,
                          String readWriter,
                          String primitiveWrapper,
                          Attribute attribute,
                          String primitiveConversion,
                          String objectName)

columnName

private String columnName(Attribute attribute,
                          String prefix,
                          int arrayIndex)

addReadType

protected void addReadType(Vector bodyLines,
                           Attribute attribute,
                           String input,
                           String readWriter)

addWriteType

protected void addWriteType(Vector bodyLines,
                            Attribute attribute,
                            String output,
                            String readWriter)

argCheck

protected static String argCheck(String argName,
                                 String argType,
                                 String fieldType,
                                 String operation,
                                 String operand,
                                 String constant,
                                 boolean isPersistent,
                                 boolean enforce_varchar_limit)

arguments

protected String arguments()

attributeName

protected final String attributeName()

biDirectionalSet

protected void biDirectionalSet(Vector bodyLines)

classInfo

protected void classInfo(Vector bodyLines)

classname

protected void classname(Vector bodyLines)

construct

protected static String construct(String type)

construct

protected static String construct(String type,
                                  int arraySize)

construct

protected static String construct(String type,
                                  String arguments)

construct

protected static String construct(Attribute attribute)

constructFactory

protected static String constructFactory(String type)

constructFactory

protected static String constructFactory(String type,
                                         String arguments)

constructor

protected void constructor(Vector bodyLines)

containerPlus

protected String containerPlus(Attribute attribute)

create

protected void create(Vector bodyLines)

defaultBody

protected void defaultBody(Vector bodyLines)

defaultReturn

protected String defaultReturn(String type)

delegator

protected void delegator(Vector bodyLines)

derivedTraversal

protected String derivedTraversal()
Obtain the String that is the code to traverse to the source field for a derived attribute.
   Example Usage:
    otherGuy.name                    // returns "getOtherGuy()"

    otherGuy.anotherGuy.name            // returns "getOtherGuy().getAnotherGuy()"

    otherGuy.getNameFromHelper().name   // returns "getOtherGuy().getNameFromHelper()"

  

Returns:
The string to invoke to execute the traversal to the target field.

evolvableRead

protected void evolvableRead(Vector bodyLines)

evolvableReadProtected

protected void evolvableReadProtected(Vector bodyLines)

evolvableWrite

protected void evolvableWrite(Vector bodyLines)

externalizationRead

protected void externalizationRead(Vector bodyLines)

externalizationReadFields

protected void externalizationReadFields(Vector bodyLines,
                                         String input,
                                         boolean oldFormat)

externalizationWrite

protected void externalizationWrite(Vector bodyLines)

genBody

protected Vector genBody(Vector bodyLines,
                         MethodBody bodyType)

genBody

public Vector genBody(Operation theSource)

get

public static JavaMethodGenerator get()

getter

protected static String getter(String getterName,
                               String type)
Obtain the String that is the getter for the attribute.
   Example Usage:
    name                    // returns "getName()"

    getName()               // returns "getName()"

  

Returns:
The string to invoke to get the attribute.

getter

protected void getter(Vector bodyLines)

getterDerived

protected void getterDerived(Vector bodyLines)

getterKeyed

protected void getterKeyed(Vector bodyLines)

getterRBcontents

protected void getterRBcontents(Vector bodyLines)

identification

protected String identification()

initialize

protected void initialize(Vector bodyLines)

instance

protected void instance(Vector bodyLines)

instantiate

protected static String instantiate(String type,
                                    String arguments)

instantiate

protected static String instantiate(Attribute attribute)

isPDSArray

protected boolean isPDSArray(Attribute attr)

keyArgs

protected String keyArgs()

mappableType

protected boolean mappableType(String type,
                               Attribute attribute)

objectCast

static String objectCast(String reader,
                         Attribute attribute)

oldVersionRead

protected void oldVersionRead(Vector bodyLines)

oldVersionReadTop

protected void oldVersionReadTop(Vector bodyLines)

genEquals

protected void genEquals(Vector bodyLines)

genHashcode

protected void genHashcode(Vector bodyLines)

PDSRead

protected void PDSRead(Vector bodyLines)

PDSWrite

protected void PDSWrite(Vector bodyLines)

readObject

protected static String readObject(ClassProperty attribute)

readWriter

protected String readWriter(Attribute attribute)

readWriterPDS

protected String readWriterPDS(Attribute attribute)

removerKeyed

protected void removerKeyed(Vector bodyLines)

returnCast

protected String returnCast()

returnNoCast

protected String returnNoCast()

setter

protected void setter(Vector bodyLines)

setterCovariant

protected void setterCovariant(Vector bodyLines)

setterDerived

protected void setterDerived(Vector bodyLines)

setterKeyed

protected void setterKeyed(Vector bodyLines)

setterValidation

protected void setterValidation(Vector bodyLines)

setterValueName

protected static String setterValueName(Operation op)

setterValueType

protected static String setterValueType(Operation op)

staticMethod

protected void staticMethod(Vector bodyLines)

superCall

protected String superCall()

tab

protected static String tab(int howMany)

toPrimitive

protected String toPrimitive()

toPrimitive

protected static String toPrimitive(String primitiveType)

toPrimitive

protected static String toPrimitive(String primitiveType,
                                    String attrName)

toStringDefault

protected void toStringDefault(Vector bodyLines)

toWrapper

protected String toWrapper()

toWrapper

protected String toWrapper(String type,
                           String name)

transformArg

protected static String transformArg(ClassProperty attr,
                                     String argument)

writeObject

protected static String writeObject(Attribute attribute)