Class JavaClassWriterHelper
java.lang.Object
com.sun.jdo.spi.persistence.utility.JavaTypeHelper
com.sun.jdo.spi.persistence.utility.generator.JavaClassWriterHelper
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String[]static final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddFields(String prop, int modifiers, JavaClassWriter writer) Adds fields to a class parsing the multi-String property.static voidaddGenericMethod(Method m, String mname, String mtype, String body, JavaClassWriter writer) Adds a method to a class parsing the multi-String property.static voidaddGenericMethod(String mname, int modifiers, String[] body, JavaClassWriter writer) Adds a private void no-args method to a class with this method body and modifiers.static voidaddGenericMethod(String mname, int modifiers, String type, String[] body, JavaClassWriter writer) Adds a private void no-args method to a class with this method body, modifiers, and return type.static voidaddGenericMethod(String mname, String[] body, JavaClassWriter writer) Adds a private void no-args method to a class with this method body.static voidaddGenericMethod(String mname, String type, String[] body, JavaClassWriter writer) Adds a private no-args method to a class with this method body and return type.static voidaddPrivateField(String prop, int modifiers, JavaClassWriter writer) Adds private fields to a class parsing the multi-String property.static String[]getBodyAsStrings(String body) Converts method body into String array.static String[]Returns exception type names as String[].static StringReturns list of method parameters in formatparam0[, param1[,...]]static StringReturns list of method parameters delimited by specified separatorstatic StringReturns list of method parameter types in formattype0[,type1[,...]]static StringgetPrimitiveType(Class cls) Returns name of the primitive type corresponding to the Object wrapper Class passed as a parameter.static StringgetTypeRepr(Class clazz) Returns the String representation of the specified class instance.static StringgetUnwrapMethodName(Class primitiveType) Returns the name of the method to access the value of the primitive type of the wrapper class.static StringgetWrapperExpr(Class exprType, String expr) A helper method which generates an expression to wrap a primitive datatype to its corresponding wrapper class.static ClassgetWrapperType(Class cls) Returns java Object wrapper Class corresponding to the primitive Class if the passed class represents a primitive.Methods inherited from class com.sun.jdo.spi.persistence.utility.JavaTypeHelper
getPackageName, getPrimitiveClass, getPrimitiveName, getShortClassName, getWrapperClass, getWrapperName, valueOf
-
Field Details
-
javaExtension_
- See Also:
-
void_
- See Also:
-
boolean_
- See Also:
-
byte_
- See Also:
-
byteArray_
- See Also:
-
param_
- See Also:
-
param0_
- See Also:
-
null_
- See Also:
-
home_
- See Also:
-
delim_
- See Also:
-
paramInitializer_
- See Also:
-
paramSeparator_
- See Also:
-
paramList_
- See Also:
-
paramConcatenator_
- See Also:
-
space_
- See Also:
-
none_
- See Also:
-
escapedEmptyString_
- See Also:
-
dot_
- See Also:
-
parenleft_
- See Also:
-
parenright_
- See Also:
-
parenthesis_
- See Also:
-
new_
- See Also:
-
endLine_
- See Also:
-
true_
- See Also:
-
false_
- See Also:
-
Collection_
- See Also:
-
Set_
- See Also:
-
PersistenceCapable_
- See Also:
-
brackets_
- See Also:
-
get_
- See Also:
-
set_
- See Also:
-
Oid_
- See Also:
-
Helper_
- See Also:
-
returnNull_
- See Also:
-
fileName_
- See Also:
-
int_
- See Also:
-
String_
- See Also:
-
Class_
- See Also:
-
Date_
- See Also:
-
SqlDate_
- See Also:
-
SqlTime_
- See Also:
-
SqlTimestamp_
- See Also:
-
Object_
- See Also:
-
super_
-
-
Constructor Details
-
JavaClassWriterHelper
public JavaClassWriterHelper()
-
-
Method Details
-
getBodyAsStrings
Converts method body into String array.- Parameters:
body- as String with each substring separated by "\n"- Returns:
- method body as String array.
-
getWrapperType
Returns java Object wrapper Class corresponding to the primitive Class if the passed class represents a primitive. If the parameter is of Object type, it is returned.- Parameters:
cls- the primitive Class to find Object wrapper for.- Returns:
- Object type Class.
-
getWrapperExpr
A helper method which generates an expression to wrap a primitive datatype to its corresponding wrapper class.- Parameters:
exprType- The class of the primitive typeexpr- The expression representing a primtive typevalue- Returns:
- A String containing the expression for wrapping the primitive datatype in its corresponding wrapperclass
-
getUnwrapMethodName
Returns the name of the method to access the value of the primitive type of the wrapper class. example: boolean.class is mapped to "booleanValue()".- Parameters:
primitiveType- the class object of the primitive type.- Returns:
- the name of the method to access the primitive value of the wrapper
-
getPrimitiveType
Returns name of the primitive type corresponding to the Object wrapper Class passed as a parameter. If the parameter is of primitive type, its name is returned.- Parameters:
cls- the Object wrapper Class to find name of the primitive type for.- Returns:
- name of the primitive type as String.
-
getExceptionNames
Returns exception type names as String[].- Parameters:
m- the Method to identify exception types for.- Returns:
- exception type names as String[].
-
getParameterTypesList
Returns list of method parameter types in formattype0[,type1[,...]]- Parameters:
m- the Method to identify list of method parameters for.- Returns:
- list of method parameter types as String
-
getParametersList
Returns list of method parameters in formatparam0[, param1[,...]]- Parameters:
m- the Method to identify list of method parameters for.- Returns:
- list of method parameters as String
-
getParametersListWithSeparator
Returns list of method parameters delimited by specified separator- Parameters:
m- the Method to identify list of method parameters for.sep- the separator to be used to delimit the parameter names- Returns:
- list of method parameters as String
-
addFields
Adds fields to a class parsing the multi-String property.- Parameters:
prop- String to use for field generation.modifiers- other field modifiers for these fields.writer- the Class writer.- Throws:
IOException- if writer fails to add a field.
-
addPrivateField
public static void addPrivateField(String prop, int modifiers, JavaClassWriter writer) throws IOException Adds private fields to a class parsing the multi-String property.- Parameters:
prop- String to use for field generation.modifiers- field modifiers for these fields.- Throws:
IOException- if writer fails to add a field.
-
addGenericMethod
public static void addGenericMethod(String mname, String[] body, JavaClassWriter writer) throws IOException Adds a private void no-args method to a class with this method body.- Parameters:
mname- method namebody- the method body as String[]- Throws:
IOException- if writer fails to add a field.
-
addGenericMethod
public static void addGenericMethod(String mname, String type, String[] body, JavaClassWriter writer) throws IOException Adds a private no-args method to a class with this method body and return type.- Parameters:
mname- method nametype- return type of the methodbody- the method body as String[]- Throws:
IOException- if writer fails to add a field.
-
addGenericMethod
public static void addGenericMethod(String mname, int modifiers, String[] body, JavaClassWriter writer) throws IOException Adds a private void no-args method to a class with this method body and modifiers.- Parameters:
mname- method namemodifiers- the method modifiersbody- the method body as String[]- Throws:
IOException- if writer fails to add a field.
-
addGenericMethod
public static void addGenericMethod(String mname, int modifiers, String type, String[] body, JavaClassWriter writer) throws IOException Adds a private void no-args method to a class with this method body, modifiers, and return type.- Parameters:
mname- method namemodifiers- the method modifierstype- return type of the methodbody- the method body as String[]- Throws:
IOException- if writer fails to add a field.
-
addGenericMethod
public static void addGenericMethod(Method m, String mname, String mtype, String body, JavaClassWriter writer) throws IOException Adds a method to a class parsing the multi-String property.- Parameters:
m- Method that describes one to be added to the bean.mname- method name if different from Method#getName(). This will be true for finder/selector/create methods.mtype- return type of the method, that can differ from the bean's local or remote interface.body- String to use for method body generation.- Throws:
IOException- if writer fails to add a field.
-
getTypeRepr
Returns the String representation of the specified class instance. An array is represented as the name of the element type followed by [].
-