Top Description Fields Constructors Methods
org.eclipse.persistence.internal.codegen

public abstract Class CodeDefinition

extends Object
Class Inheritance
Known Direct Subclasses
org.eclipse.persistence.internal.codegen.MethodDefinition, org.eclipse.persistence.internal.codegen.AttributeDefinition, org.eclipse.persistence.internal.codegen.ClassDefinition
Imports
java.util.HashSet, .Map, .Set

INTERNAL:

Purpose: Model a element of code generation purposes.

Author
James Sutherland
Since
TopLink 3.0

Field Summary

Modifier and TypeField and Description
protected AccessLevel
protected String
protected static final String
protected static final String
protected String

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
private static boolean
adjustmentNeededForType(String typeName, Map<String, Set<String>> typeNameMap)

protected static String
adjustTypeName(String typeName, Map<String, Set<String>> typeNameMap)

Compares the typeName to those stored in the typeNameMap.

public AccessLevel
public String
public String
private static String
packageName(String typeName)

protected static Set<String>
parseForTypeNames(String longString)

Returns a set of java.lang.String type names included in longString.

private static Set<String>
parseForTypeNamesInPackage(String longString, String packageName)

protected static void
putTypeNameInMap(String typeName, Map<String, Set<String>> typeNameMap)

Used for calculating imports.

public void
public void
setComment(String comment)

public void
private static String
shortName(String typeName)

Removes the package name, if there is one.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public void
write(CodeGenerator generator)

Write the code out to the generator's stream.

public abstract void
writeBody(CodeGenerator generator)

Write the code out to the generator's stream.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

accessLevelback to summary
protected AccessLevel accessLevel
commentback to summary
protected String comment
JAVA_LANG_PACKAGE_NAMEback to summary
protected static final String JAVA_LANG_PACKAGE_NAME
JAVA_UTIL_PACKAGE_NAMEback to summary
protected static final String JAVA_UTIL_PACKAGE_NAME
nameback to summary
protected String name

Constructor Detail

CodeDefinitionback to summary
protected CodeDefinition()

Method Detail

adjustmentNeededForTypeback to summary
private static boolean adjustmentNeededForType(String typeName, Map<String, Set<String>> typeNameMap)
adjustTypeNameback to summary
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.)

getAccessLevelback to summary
public AccessLevel getAccessLevel()
getCommentback to summary
public String getComment()
getNameback to summary
public String getName()
packageNameback to summary
private static String packageName(String typeName)
parseForTypeNamesback to summary
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.

parseForTypeNamesInPackageback to summary
private static Set<String> parseForTypeNamesInPackage(String longString, String packageName)
putTypeNameInMapback to summary
protected static void putTypeNameInMap(String typeName, Map<String, Set<String>> typeNameMap)

Used for calculating imports. @see org.eclipse.persistence.internal.codegen.ClassDefinition#calculateImports()

setAccessLevelback to summary
public void setAccessLevel(AccessLevel accessLevel)
setCommentback to summary
public void setComment(String comment)
setNameback to summary
public void setName(String name)
shortNameback to summary
private static String shortName(String typeName)

Removes the package name, if there is one. Also removes any trailing brackets. 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.)

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
writeback to summary
public void write(CodeGenerator generator)

Write the code out to the generator's stream.

writeBodyback to summary
public abstract void writeBody(CodeGenerator generator)

Write the code out to the generator's stream.