Module org.eclipse.persistence.core
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 AccessLevelaccessLevelprotected Stringcommentprotected static StringJAVA_LANG_PACKAGE_NAMEprotected static StringJAVA_UTIL_PACKAGE_NAMEprotected Stringnameprotected static StringTOPLINK_INDIRECTION_PACKAGE_NAME
-
Constructor Summary
Constructors Modifier Constructor Description protectedCodeDefinition()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected static StringadjustTypeName(String typeName, Map<String,Set<String>> typeNameMap)Compares the typeName to those stored in the typeNameMap.AccessLevelgetAccessLevel()StringgetComment()StringgetName()protected static Set<String>parseForTypeNames(String longString)Returns a set of java.lang.String type names included in longString.protected static voidputTypeNameInMap(String typeName, Map<String,Set<String>> typeNameMap)Used for calculating imports.voidsetAccessLevel(AccessLevel accessLevel)voidsetComment(String comment)voidsetName(String name)StringtoString()voidwrite(CodeGenerator generator)Write the code out to the generator's stream.abstract voidwriteBody(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<String,Set<String>> 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<String> 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<String,Set<String>> 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.
-
-