Oracle Application Server TopLink API Reference
10g Release 2 (10.1.2)

B15903-01


oracle.toplink.tools.codegen
Class ClassDefinition

java.lang.Object
  extended byoracle.toplink.tools.codegen.CodeDefinition
      extended byoracle.toplink.tools.codegen.ClassDefinition


public class ClassDefinition
extends CodeDefinition

Purpose: Model a class for code generation purposes.

Since:
TopLink 3.0

Field Summary
static int CLASS_TYPE
static int INTERFACE_TYPE

Constructor Summary
ClassDefinition()

Method Summary
void addAttribute(AttributeDefinition attribute)
void addImport(java.lang.String importStatement)
The importStatement should be of the form "{packageName}.
void addInterface(java.lang.String interfaceClassName)
void addMethod(MethodDefinition method)
void calculateImports()
Parses the class definition, pulls out fully qualified class names, adds imports for them, and un-fully qualifies the class names
boolean containsMethod(MethodDefinition method)
java.lang.String getPackageName()
java.lang.String getSuperClass()
int getType()
boolean isInterface()
void setPackageName(java.lang.String packageName)
void setSuperClass(java.lang.String superClass)
If the class to be generated is an interface, do not use this method.
void setType(int type)
void write(CodeGenerator generator)
Write the code out to the generator's stream.
void writeBody(CodeGenerator generator)
Write the code out to the generator's stream.

Methods inherited from class oracle.toplink.tools.codegen.CodeDefinition
getAccessLevel, getComment, getName, setAccessLevel, setComment, setName, toString

Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Field Detail

CLASS_TYPE

public static final int CLASS_TYPE
See Also:
Constant Field Values

INTERFACE_TYPE

public static final int INTERFACE_TYPE
See Also:
Constant Field Values

Constructor Detail

ClassDefinition

public ClassDefinition()

Method Detail

addAttribute

public void addAttribute(AttributeDefinition attribute)

addImport

public void addImport(java.lang.String importStatement)
The importStatement should be of the form "{packageName}.{shortName or '*'}"

addInterface

public void addInterface(java.lang.String interfaceClassName)

addMethod

public void addMethod(MethodDefinition method)

calculateImports

public void calculateImports()
Parses the class definition, pulls out fully qualified class names, adds imports for them, and un-fully qualifies the class names. - Assumes that no imports have been previously added. - Assumes that all types have been fully qualified to start. - Will not unqualify ambiguous classes (java.util.Date and java.sql.Date). - Will not add imports for java.lang.* - Will not add imports for classes in the same package. - Will not parse method bodies, but will unqualify types it finds. ?? - Should unqualification occur during writing? That way, reflective definitions could take advantage.

containsMethod

public boolean containsMethod(MethodDefinition method)

getPackageName

public java.lang.String getPackageName()

getSuperClass

public java.lang.String getSuperClass()

getType

public int getType()

isInterface

public boolean isInterface()

setPackageName

public void setPackageName(java.lang.String packageName)

setSuperClass

public void setSuperClass(java.lang.String superClass)
If the class to be generated is an interface, do not use this method. Instead, use addInterface(String) for each interface superclass.

setType

public void setType(int type)

write

public void write(CodeGenerator generator)
Write the code out to the generator's stream.
Overrides:
write in class CodeDefinition

writeBody

public void writeBody(CodeGenerator generator)
Write the code out to the generator's stream.
Specified by:
writeBody in class CodeDefinition

Copyright © 1998, 2005 Oracle Corporation. All Rights Reserved.