|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanetj.dataengine.RowClassGenerator
Contains methods for generating a subclass of planetj.database.Row
Field Summary | |
protected static java.lang.String |
CLASS_COMMENT
|
protected static java.lang.String |
COMMA
|
protected static java.lang.String |
CURLY_BRACE_OPEN
|
protected static java.lang.String |
CURLY_BRANCE_CLOSE
|
protected static java.lang.String |
DATAENGINE_COPYRIGHT
|
protected static java.lang.String |
EQUALS_SIGN
|
protected static java.lang.String |
EXTENDS
|
protected static java.lang.String |
GET
|
protected static java.lang.String |
GET_FIELD_VALUE
|
protected static java.lang.String |
GETTER_COMMENT_BEGIN
|
protected static java.lang.String |
INTERFACE_COMMENT
|
protected static java.lang.String |
LIBRARY_NAME
|
protected static java.lang.String |
METHOD_COMMENT_END
|
protected static java.lang.String |
NEW
|
protected static java.lang.String |
NEW_VALUE
|
protected static java.lang.String |
NUMBER
|
protected static java.lang.String |
OPEN_CLOSE_PAREN
|
protected static java.lang.String |
PACKAGE
|
protected static java.lang.String |
PUBLIC
|
protected static java.lang.String |
PUBLIC_CLASS
|
protected static java.lang.String |
PUBLIC_INTERFACE
|
protected static java.lang.String |
RETURN
|
protected static java.lang.String |
RETURN_THIS
|
protected static java.lang.String |
SEMICOLON
|
protected static java.lang.String |
SET
|
protected static java.lang.String |
SET_FIELD_VALUE
|
protected static java.lang.String |
SETTER_COMMENT_BEGIN
|
protected static java.lang.String |
STATIC_FINAL_STRING
|
protected static java.lang.String |
TABLE_NAME
|
protected static java.lang.String |
THROWS_CMEXCEPTION
|
protected static java.lang.String |
VALUE
|
protected static java.lang.String |
VOID
|
Constructor Summary | |
protected |
RowClassGenerator()
RowClassGenerator constructor comment. |
Method Summary | |
static void |
formatNames(java.lang.String pName,
java.lang.StringBuffer pMethodName,
java.lang.StringBuffer pConstantName)
Formats a name into "Java method" format and "Java constant" format. |
protected static java.lang.StringBuffer |
generateClassDefinitionBeginning(java.lang.String pPackageAndClassName,
java.lang.StringBuffer pSB,
boolean pIsInterface)
Appends the beginning of a Java class or interface definition to a StringBuffer. |
protected static java.lang.StringBuffer |
generateComment(java.lang.StringBuffer pSB,
boolean pIsInterface)
Generates a Java class or interface comment. |
static java.lang.StringBuffer |
generateConstant(java.lang.String sqlName,
java.lang.String constantName,
java.lang.StringBuffer sb)
Generates a Java code for defining a constant. |
static java.lang.StringBuffer |
generateConstantComments(FieldDescriptorRow pFd,
java.lang.StringBuffer pSB)
Generates a Java constant comment |
static java.lang.StringBuffer |
generateConstantTableProperties(RowClassProperties pProps,
java.lang.StringBuffer sb)
This method will generate the TABLE_NAME and LIBRARY_NAME constants Creation date: (4/9/2002 1:27:51 PM) |
static java.lang.StringBuffer |
generateGetter(java.lang.String columnName,
java.lang.String constant,
java.lang.Class fieldType,
boolean usePrimitive,
java.lang.StringBuffer sb)
Appends to a StringBuffer a String defining a Java method which gets the value of a field |
protected static java.lang.StringBuffer |
generateNewNumberObject(java.lang.Class fieldClass,
java.lang.String primitiveName,
java.lang.StringBuffer sb)
Appends a String of Java code for creating a new instance of a Java wrapper class (like Integer) to a StringBuffer. |
protected static java.lang.StringBuffer |
generateObjectGetter(java.lang.String columnName,
java.lang.String constant,
java.lang.Class returnType,
java.lang.StringBuffer method)
Appends to a StringBuffer a String defining a Java method which gets the value of a field |
protected static java.lang.StringBuffer |
generateObjectSetter(java.lang.String columnName,
java.lang.String constant,
java.lang.Class fieldType,
java.lang.String thisClassName,
java.lang.StringBuffer method)
Appends to a StringBuffer a String defining a Java method which sets the value of a field |
protected static java.lang.StringBuffer |
generatePrimitiveNumberGetter(java.lang.String columnName,
java.lang.String constant,
java.lang.Class returnType,
java.lang.StringBuffer method)
Appends to a StringBuffer a String defining a Java method which gets the value of a field as a primitive number. |
protected static java.lang.StringBuffer |
generatePrimitiveNumberSetter(java.lang.String columnName,
java.lang.String constant,
java.lang.Class fieldType,
java.lang.String thisClassName,
java.lang.StringBuffer method)
Appends to a StringBuffer a String defining a Java method which sets the value of a field, based on a primitive |
static java.lang.String |
generateRowClass(java.util.Iterator pFieldDescriptors,
RowClassProperties pProps)
Generates a subclass of the Row class. |
static java.lang.String |
generateRowClass(RowCollection pRC,
RowClassProperties pProps)
Generates a subclass of the Row class. |
static java.lang.String |
generateRowClass(Table pTable,
RowClassProperties pProps)
Generates a subclass of the Row class. |
static java.lang.String |
generateRowInterface(java.util.Iterator pFieldDescriptors,
RowInterfaceProperties pProps)
Generates an interface based on a Database Row. |
static java.lang.String |
generateRowInterface(RowCollection pRC,
RowInterfaceProperties pProps)
Generates an interface based on a Database Row. |
static java.lang.String |
generateRowInterface(Table pTable,
RowInterfaceProperties pProps)
Generates an interface based on a Database Row. |
static java.lang.StringBuffer |
generateSetter(java.lang.String columnName,
java.lang.String constant,
java.lang.Class fieldType,
boolean usePrimitive,
java.lang.String className,
java.lang.StringBuffer sb)
Appends to a StringBuffer a String defining a Java method which sets the value of a field |
static java.lang.String |
write(java.lang.String pClassDef,
RowClassProperties pProps)
Write the generate class/interface file to the fileLocation Creation date: (4/1/2002 6:22:55 PM) |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String STATIC_FINAL_STRING
protected static final java.lang.String GETTER_COMMENT_BEGIN
protected static final java.lang.String SETTER_COMMENT_BEGIN
protected static final java.lang.String METHOD_COMMENT_END
protected static final java.lang.String EQUALS_SIGN
protected static final java.lang.String SEMICOLON
protected static final java.lang.String PUBLIC_CLASS
protected static final java.lang.String PUBLIC_INTERFACE
protected static final java.lang.String CURLY_BRACE_OPEN
protected static final java.lang.String CURLY_BRANCE_CLOSE
protected static final java.lang.String OPEN_CLOSE_PAREN
protected static final java.lang.String GET
protected static final java.lang.String SET
protected static final java.lang.String PUBLIC
protected static final java.lang.String VOID
protected static final java.lang.String GET_FIELD_VALUE
protected static final java.lang.String SET_FIELD_VALUE
protected static final java.lang.String THROWS_CMEXCEPTION
protected static final java.lang.String RETURN
protected static final java.lang.String NUMBER
protected static final java.lang.String VALUE
protected static final java.lang.String NEW_VALUE
protected static final java.lang.String RETURN_THIS
protected static final java.lang.String COMMA
protected static final java.lang.String NEW
protected static final java.lang.String PACKAGE
protected static final java.lang.String CLASS_COMMENT
protected static final java.lang.String INTERFACE_COMMENT
protected static final java.lang.String EXTENDS
protected static final java.lang.String LIBRARY_NAME
protected static final java.lang.String TABLE_NAME
protected static final java.lang.String DATAENGINE_COPYRIGHT
Constructor Detail |
protected RowClassGenerator()
Method Detail |
public static void formatNames(java.lang.String pName, java.lang.StringBuffer pMethodName, java.lang.StringBuffer pConstantName)
pName
- The name to formatpMethodName
- A StringBuffer which will contain the method fomatted namepConstantName
- A StringBuffer which will contain the constant formatted nameprotected static java.lang.StringBuffer generateClassDefinitionBeginning(java.lang.String pPackageAndClassName, java.lang.StringBuffer pSB, boolean pIsInterface)
pSB
- The StringBuffer to append the class definition topIsInterface
- true if this class to be generated is an interface
protected static java.lang.StringBuffer generateComment(java.lang.StringBuffer pSB, boolean pIsInterface)
pSB
- A StringBuffer to which the comment will be appendedpIsInterface
- true if this class to be generated is an interface
public static java.lang.StringBuffer generateConstant(java.lang.String sqlName, java.lang.String constantName, java.lang.StringBuffer sb)
sqlName
- The SQL name of the fieldconstantName
- The name of the constantsb
- The StringBuffer to append the Java code to
public static java.lang.StringBuffer generateConstantComments(FieldDescriptorRow pFd, java.lang.StringBuffer pSB) throws CMException
pSB
- A StringBuffer to which the comment will be appendedpFd
- FieldDescriptorRow describing the field.
CMException
public static java.lang.StringBuffer generateConstantTableProperties(RowClassProperties pProps, java.lang.StringBuffer sb)
public static java.lang.StringBuffer generateGetter(java.lang.String columnName, java.lang.String constant, java.lang.Class fieldType, boolean usePrimitive, java.lang.StringBuffer sb)
columnName
- The name of the column. The method's name will be the String "get" with
this parameter appended on. If the constant
parameter is null, then this value must
be the field's SQL name.constant
- The constant which maps a field's SQL name to a human-formatted name.fieldType
- The type of object the field holdsusePrimitive
- Whether or not the generated method should return a primitive. This parameter is
ignored if there is no primitive type which corresponds to the type of object the field holds.sb
- The StringBuffer to which the method will be appended
protected static java.lang.StringBuffer generateNewNumberObject(java.lang.Class fieldClass, java.lang.String primitiveName, java.lang.StringBuffer sb)
fieldClass
- The type of object the field holdsprimitiveName
- The name of the primitive type (like "int")sb
- The StringBuffer to which the Java code will be appended.
protected static java.lang.StringBuffer generateObjectGetter(java.lang.String columnName, java.lang.String constant, java.lang.Class returnType, java.lang.StringBuffer method)
columnName
- The name of the column. The method's name will be the String "get" with
this parameter appended on. If the constant
parameter is null, then this value must
be the field's SQL name.constant
- The constant which maps a field's SQL name to a human-formatted name.returnType
- The type of object to return (this must not be a primitive type)method
- The StringBuffer to which the method will be appended
protected static java.lang.StringBuffer generateObjectSetter(java.lang.String columnName, java.lang.String constant, java.lang.Class fieldType, java.lang.String thisClassName, java.lang.StringBuffer method)
columnName
- The name of the column. The method's name will be the String "get" with
this parameter appended on. If the constant
parameter is null, then this value must
be the field's SQL name.constant
- The constant which maps a field's SQL name to a human-formatted name.thisClassName
- The name of the class for which this method is generated. The generated method will
have this type of return value (so it can return "this") as long as this parameter is not null. If this
parameter is null, the generated method will have a return type of void.method
- The StringBuffer to which the method will be appended
protected static java.lang.StringBuffer generatePrimitiveNumberGetter(java.lang.String columnName, java.lang.String constant, java.lang.Class returnType, java.lang.StringBuffer method)
columnName
- The name of the column. The method's name will be the String "get" with
this parameter appended on. If the constant
parameter is null, then this value must
be the field's SQL name.constant
- The constant which maps a field's SQL name to a human-formatted name.returnType
- The type of primitive to return. This should be the int, short, byte, float, double, or
long class object.method
- The StringBuffer to which the method will be appended
protected static java.lang.StringBuffer generatePrimitiveNumberSetter(java.lang.String columnName, java.lang.String constant, java.lang.Class fieldType, java.lang.String thisClassName, java.lang.StringBuffer method)
columnName
- The name of the column. The method's name will be the String "get" with
this parameter appended on. If the constant
parameter is null, then this value must
be the field's SQL name.constant
- The constant which maps a field's SQL name to a human-formatted name.thisClassName
- The name of the class for which this method is generated. The generated method will
have this type of return value (so it can return "this") as long as this parameter is not null. If this
parameter is null, the generated method will have a return type of void.method
- The StringBuffer to which the method will be appended
public static java.lang.String generateRowClass(java.util.Iterator pFieldDescriptors, RowClassProperties pProps) throws CMException
pFieldDescriptors
- The field descriptors describing the fields which the generated class should
supportpProps
- A RowClassProperties
object containing properties
describing how the class should be genereated.
CMException
public static java.lang.String generateRowClass(RowCollection pRC, RowClassProperties pProps) throws CMException
pRC
- A RowCollection containg field descriptors which describe the fields the generated class should
supportpProps
- A RowClassProperties
object containing properties
describing how the class should be genereated.
CMException
public static java.lang.String generateRowClass(Table pTable, RowClassProperties pProps) throws CMException
pTable
- A Table containg field descriptors which describe the fields the generated class should
supportpProps
- A RowClassProperties
object containing properties
describing how the class should be genereated.
CMException
public static java.lang.String generateRowInterface(java.util.Iterator pFieldDescriptors, RowInterfaceProperties pProps) throws CMException
pFieldDescriptors
- The field descriptors describing the fields which the generated class should
supportpProps
- A RowInterfaceProperties
object containing properties
describing how the class should be genereated.
CMException
public static java.lang.String generateRowInterface(RowCollection pRC, RowInterfaceProperties pProps) throws CMException
pRC
- A RowCollection containg field descriptors which describe the fields the generated class should
supportpProps
- A RowInterfaceProperties
object containing properties
describing how the class should be genereated.
CMException
public static java.lang.String generateRowInterface(Table pTable, RowInterfaceProperties pProps) throws CMException
pTable
- A Table containg field descriptors which describe the fields the generated class should
supportpProps
- A RowInterfaceProperties
object containing properties
describing how the class should be genereated.
CMException
public static java.lang.StringBuffer generateSetter(java.lang.String columnName, java.lang.String constant, java.lang.Class fieldType, boolean usePrimitive, java.lang.String className, java.lang.StringBuffer sb)
columnName
- The name of the column. The method's name will be the String "get" with
this parameter appended on. If the constant
parameter is null, then this value must
be the field's SQL name.constant
- The constant which maps a field's SQL name to a human-formatted name.usePrimitive
- Whether or not the set method should take in a primitive or an Object. This
parameter is ignored if there is no corresponding primitive type for the field type.className
- The name of the class for which this method is generated. The generated method will
have this type of return value (so it can return "this") as long as this parameter is not null. If this
parameter is null, the generated method will have a return type of void.sb
- The StringBuffer to which the method will be appended
public static java.lang.String write(java.lang.String pClassDef, RowClassProperties pProps) throws CMException
CMException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |