Class CodeDefinition
- java.lang.Object
-
- org.eclipse.persistence.internal.codegen.CodeDefinition
-
- Direct Known Subclasses:
AttributeDefinition
,ClassDefinition
,MethodDefinition
public abstract class CodeDefinition extends Object
INTERNAL:Purpose: Model a element of code generation purposes.
- Since:
- TopLink 3.0
- Author:
- James Sutherland
-
-
Field Summary
Fields Modifier and Type Field Description protected AccessLevel
accessLevel
protected String
comment
protected static String
JAVA_LANG_PACKAGE_NAME
protected static String
JAVA_UTIL_PACKAGE_NAME
protected String
name
protected static String
TOPLINK_INDIRECTION_PACKAGE_NAME
-
Constructor Summary
Constructors Constructor Description CodeDefinition()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static String
adjustTypeName(String typeName, Map typeNameMap)
Compares the typeName to those stored in the typeNameMap.AccessLevel
getAccessLevel()
String
getComment()
String
getName()
protected static Set
parseForTypeNames(String longString)
Returns a set of java.lang.String type names included in longString.protected static void
putTypeNameInMap(String typeName, Map typeNameMap)
Used for calculating imports.void
setAccessLevel(AccessLevel accessLevel)
void
setComment(String comment)
void
setName(String name)
String
toString()
void
write(CodeGenerator generator)
Write the code out to the generator's stream.abstract void
writeBody(CodeGenerator generator)
Write the code out to the generator's stream.
-
-
-
Field Detail
-
accessLevel
protected AccessLevel accessLevel
-
name
protected String name
-
comment
protected String comment
-
JAVA_LANG_PACKAGE_NAME
protected static final String JAVA_LANG_PACKAGE_NAME
- See Also:
- Constant Field Values
-
JAVA_UTIL_PACKAGE_NAME
protected static final String JAVA_UTIL_PACKAGE_NAME
- See Also:
- Constant Field Values
-
TOPLINK_INDIRECTION_PACKAGE_NAME
protected static final String TOPLINK_INDIRECTION_PACKAGE_NAME
- See Also:
- Constant Field Values
-
-
Method Detail
-
adjustTypeName
protected static String adjustTypeName(String typeName, Map typeNameMap)
Compares the typeName to those stored in the typeNameMap. If the short name of the typeName is unambiguous (only one package for that short name in the Map), removes the package name and returns the short name, else returns the whole thing. Assumes that typeName contains only a package name (optional) and a short name, potentially with subtended brackets. (e.g. int -> int, java.util.Vector -> Vector, java.lang.Boolean[] -> Boolean[], etc.)
-
parseForTypeNames
protected static Set parseForTypeNames(String longString)
Returns a set of java.lang.String type names included in longString. Will only look for ValueHolder, java.util collection types, and TopLink indirect collection types. All other searches too intractable at this point.
-
putTypeNameInMap
protected static void putTypeNameInMap(String typeName, Map typeNameMap)
Used for calculating imports. @see org.eclipse.persistence.internal.codegen.ClassDefinition#calculateImports()
-
getAccessLevel
public AccessLevel getAccessLevel()
-
getComment
public String getComment()
-
getName
public String getName()
-
setAccessLevel
public void setAccessLevel(AccessLevel accessLevel)
-
setComment
public void setComment(String comment)
-
setName
public void setName(String name)
-
write
public void write(CodeGenerator generator)
Write the code out to the generator's stream.
-
writeBody
public abstract void writeBody(CodeGenerator generator)
Write the code out to the generator's stream.
-
-