|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.arch4j.generator.JavaDefinition | +--org.arch4j.generator.JavaObjectDefinition | +--org.arch4j.generator.JavaClassDefinition
This class is used to define the attributes of a Java class. The attributes can then be used to generate a valid Java class definition string.
The number of constructors are meant to make it easy to define a class with as few statements as possible. Once constructed, additional methods can be sent to further define the class.
Field Summary | |
protected boolean |
isAbstract
Is the class abstract? Default = false. |
protected boolean |
isFinal
Is the class final? Default = false. |
protected JavaType |
superClassName
The superclass, defined as a Java type. |
Fields inherited from class org.arch4j.generator.JavaObjectDefinition |
implementedInterfaces, isStrict, objectName |
Fields inherited from class org.arch4j.generator.JavaDefinition |
accessModifier, comment |
Fields inherited from interface org.arch4j.generator.JavaKeywordConstants |
ABSTRACT, CATCH, CLASS, DEFAULT_ACCESS, EXTENDS, FALSE, FINAL, FINALLY, IMPLEMENTS, IMPORT, INTERFACE, NATIVE, NEW, NULL, PACKAGE, PRIVATE, PROTECTED, PUBLIC, RETURN, STATIC, STRICTFP, SUPER, SYNCHRONIZED, THIS, THROW, THROWS, TRANSIENT, TRUE, TRY, VOID, VOLATILE |
Fields inherited from interface org.arch4j.generator.JavaPrimitiveConstants |
BOOLEAN, BYTE, CHAR, DOUBLE, FLOAT, INT, LONG, SHORT |
Constructor Summary | |
JavaClassDefinition(JavaType className)
Constructs a JavaClassDefinition with the specified
Java class type. |
|
JavaClassDefinition(JavaType className,
JavaType superClassName)
Constructs a JavaClassDefinition with the specified
Java class type and superclass type. |
|
JavaClassDefinition(JavaType className,
JavaType superClassName,
List implementedInterfaces)
Constructs a JavaClassDefinition with the specified
Java class type, superclass type, and list of implemented interfaces. |
|
JavaClassDefinition(JavaType className,
List implementedInterfaces)
Constructs a JavaClassDefinition with the specified
Java class type, and list of implemented interfaces. |
|
JavaClassDefinition(String className)
Constructs a JavaClassDefinition with the specified
class name. |
|
JavaClassDefinition(String comment,
JavaAccessModifier accessModifier,
boolean isAbstract,
boolean isFinal,
boolean isStrict,
JavaType className,
JavaType superClassName,
List implementedInterfaces)
Constructs a JavaClassDefinition with the specified
comment, access control modifier, Java class type,
superclass type, list of implemented interfaces,
whether the class is abstract or final,
and whether the object needs strictfp floating-point calculations. |
|
JavaClassDefinition(String comment,
JavaAccessModifier accessModifier,
boolean isAbstract,
boolean isFinal,
JavaType className,
JavaType superClassName,
List implementedInterfaces)
Constructs a JavaClassDefinition with the specified
comment, access control modifier, Java class type,
superclass type, list of implemented interfaces,
and whether the class is abstract or final. |
|
JavaClassDefinition(String comment,
JavaAccessModifier accessModifier,
JavaType className)
Constructs a JavaClassDefinition with the specified
comment, access control modifier, and Java class type. |
|
JavaClassDefinition(String comment,
JavaAccessModifier accessModifier,
JavaType className,
JavaType superClassName)
Constructs a JavaClassDefinition with the specified
comment, access control modifier, Java class type,
and superclass type. |
|
JavaClassDefinition(String comment,
JavaAccessModifier accessModifier,
JavaType className,
JavaType superClassName,
List implementedInterfaces)
Constructs a JavaClassDefinition with the specified
comment, access control modifier, Java class type,
superclass type, and list of implemented interfaces. |
|
JavaClassDefinition(String className,
List implementedInterfaces)
Constructs a JavaClassDefinition with the specified
class name, and list of implemented interfaces. |
|
JavaClassDefinition(String className,
String superClassName)
Constructs a JavaClassDefinition with the specified
class name and superclass name. |
|
JavaClassDefinition(String comment,
String accessModifier,
boolean isAbstract,
boolean isFinal,
boolean isStrict,
String className,
String superClassName,
List implementedInterfaces)
Constructs a JavaClassDefinition with the specified
comment, access control modifier, class name,
superclass name, list of implemented interfaces,
whether the class is abstract or final,
and whether the object needs strictfp floating-point calculations. |
|
JavaClassDefinition(String comment,
String accessModifier,
boolean isAbstract,
boolean isFinal,
String className,
String superClassName,
List implementedInterfaces)
Constructs a JavaClassDefinition with the specified
comment, access control modifier, class name,
superclass name, list of implemented interfaces,
and whether the class is abstract or final. |
|
JavaClassDefinition(String className,
String superClassName,
List implementedInterfaces)
Constructs a JavaClassDefinition with the specified
class name, superclass name, and list of implemented interfaces. |
|
JavaClassDefinition(String comment,
String accessModifier,
String className)
Constructs a JavaClassDefinition with the specified
comment, access control modifier, and class name. |
|
JavaClassDefinition(String comment,
String accessModifier,
String className,
String superClassName)
Constructs a JavaClassDefinition with the specified
comment, access control modifier, class name,
and superclass name. |
|
JavaClassDefinition(String comment,
String accessModifier,
String className,
String superClassName,
List implementedInterfaces)
Constructs a JavaClassDefinition with the specified
comment, access control modifier, class name,
superclass name, and list of implemented interfaces. |
Method Summary | |
List |
getImports()
Returns a list of potential import types for the object. |
String |
getName()
Returns the name of this class. |
String |
getObjectKeyword()
Returns the object keyword for the object. |
String |
getPackageName()
Returns the package within which this class is defined. |
JavaType |
getSuperClass()
Returns the Java type that represents the class that this class extends. |
String |
getSuperClassName()
Returns the name of the class that this class extends. |
boolean |
isAbstract()
Returns whether the object is abstract or not. |
boolean |
isClassDefinition()
Returns that this class is a class definition. |
boolean |
isFinal()
Returns whether the object is final or not. |
void |
setAbstract(boolean value)
Set whether the object is abstract or not. |
void |
setFinal(boolean value)
Set whether the object is final or not. |
void |
writeDefinitionTo(CodeBuffer buffer)
Write the Java source representation of the definition to the CodeBuffer . |
Methods inherited from class org.arch4j.generator.JavaObjectDefinition |
addImplementedInterface, addImplementedInterface, addImplementedInterfaces, getImplementedInterfaces, getObjectName, isInterfaceDefinition, isStrict, setImplementedInterfaces, setStrict |
Methods inherited from class org.arch4j.generator.JavaDefinition |
getAccessModifier, getComment, getDefinition, hasComment, setAccessModifier, setComment |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected boolean isAbstract
protected boolean isFinal
protected JavaType superClassName
Constructor Detail |
public JavaClassDefinition(String className)
JavaClassDefinition
with the specified
class name.
The access control modifier defaults to public access.
className
- The class name.public JavaClassDefinition(JavaType className)
JavaClassDefinition
with the specified
Java class type.
The access control modifier defaults to public access.
className
- The class's Java type specification.public JavaClassDefinition(String className, String superClassName)
JavaClassDefinition
with the specified
class name and superclass name.
The access control modifier defaults to public access.
className
- The class name.superClassName
- The superclass name.public JavaClassDefinition(JavaType className, JavaType superClassName)
JavaClassDefinition
with the specified
Java class type and superclass type.
The access control modifier defaults to public access.
className
- The class's Java type specification.superClassName
- The superclass Java type specification.public JavaClassDefinition(String className, List implementedInterfaces)
JavaClassDefinition
with the specified
class name, and list of implemented interfaces.
The list should contain JavaType
objects representing each
interface that this class implements.
Strings will be converted, though, if it is more convenient to use Strings.
The access control modifier defaults to public access.
className
- The class name.implementedInterfaces
- The list of implemented interfaces.public JavaClassDefinition(JavaType className, List implementedInterfaces)
JavaClassDefinition
with the specified
Java class type, and list of implemented interfaces.
The list should contain JavaType
objects representing each
interface that this class implements.
Strings will be converted, though, if it is more convenient to use Strings.
The access control modifier defaults to public access.
className
- The class's Java type specification.implementedInterfaces
- The list of implemented interfaces.public JavaClassDefinition(String className, String superClassName, List implementedInterfaces)
JavaClassDefinition
with the specified
class name, superclass name, and list of implemented interfaces.
The list should contain JavaType
objects representing each
interface that this class implements.
Strings will be converted, though, if it is more convenient to use Strings.
The access control modifier defaults to public access.
className
- The class name.superClassName
- The superclass name.implementedInterfaces
- The list of implemented interfaces.public JavaClassDefinition(JavaType className, JavaType superClassName, List implementedInterfaces)
JavaClassDefinition
with the specified
Java class type, superclass type, and list of implemented interfaces.
The list should contain JavaType
objects representing each
interface that this class implements.
Strings will be converted, though, if it is more convenient to use Strings.
The access control modifier defaults to public access.
className
- The class's Java type specification.superClassName
- The superclass Java type specification.implementedInterfaces
- The list of implemented interfaces.public JavaClassDefinition(String comment, String accessModifier, String className)
JavaClassDefinition
with the specified
comment, access control modifier, and class name.
comment
- The class's descriptive comment.accessModifier
- The class's access control modifier.className
- The class name.public JavaClassDefinition(String comment, JavaAccessModifier accessModifier, JavaType className)
JavaClassDefinition
with the specified
comment, access control modifier, and Java class type.
comment
- The class's descriptive comment.accessModifier
- The class's access control modifier.className
- The class's Java type specification.public JavaClassDefinition(String comment, String accessModifier, String className, String superClassName)
JavaClassDefinition
with the specified
comment, access control modifier, class name,
and superclass name.
comment
- The class's descriptive comment.accessModifier
- The class's access control modifier.className
- The class name.superClassName
- The superclass name.public JavaClassDefinition(String comment, JavaAccessModifier accessModifier, JavaType className, JavaType superClassName)
JavaClassDefinition
with the specified
comment, access control modifier, Java class type,
and superclass type.
comment
- The class's descriptive comment.accessModifier
- The class's access control modifier.className
- The class's Java type specification.superClassName
- The superclass Java type specification.public JavaClassDefinition(String comment, String accessModifier, String className, String superClassName, List implementedInterfaces)
JavaClassDefinition
with the specified
comment, access control modifier, class name,
superclass name, and list of implemented interfaces.
The list should contain JavaType
objects representing each
interface that this class implements.
Strings will be converted, though, if it is more convenient to use Strings.
comment
- The class's descriptive comment.accessModifier
- The class's access control modifier.className
- The class name.superClassName
- The superclass name.implementedInterfaces
- The list of implemented interfaces.public JavaClassDefinition(String comment, JavaAccessModifier accessModifier, JavaType className, JavaType superClassName, List implementedInterfaces)
JavaClassDefinition
with the specified
comment, access control modifier, Java class type,
superclass type, and list of implemented interfaces.
The list should contain JavaType
objects representing each
interface that this class implements.
Strings will be converted, though, if it is more convenient to use Strings.
comment
- The class's descriptive comment.accessModifier
- The class's access control modifier.className
- The class's Java type specification.superClassName
- The superclass Java type specification.implementedInterfaces
- The list of implemented interfaces.public JavaClassDefinition(String comment, String accessModifier, boolean isAbstract, boolean isFinal, String className, String superClassName, List implementedInterfaces)
JavaClassDefinition
with the specified
comment, access control modifier, class name,
superclass name, list of implemented interfaces,
and whether the class is abstract or final.
A class cannot be both abstract and final, so if both are
specified as true
, the class will be declared abstract.
The list should contain JavaType
objects representing each
interface that this class implements.
Strings will be converted, though, if it is more convenient to use Strings.
comment
- The class's descriptive comment.accessModifier
- The class's access control modifier.isAbstract
- true if the class is defined to be abstract.isFinal
- true if the class is defined to be final.className
- The class name.superClassName
- The superclass name.implementedInterfaces
- The list of implemented interfaces.public JavaClassDefinition(String comment, JavaAccessModifier accessModifier, boolean isAbstract, boolean isFinal, JavaType className, JavaType superClassName, List implementedInterfaces)
JavaClassDefinition
with the specified
comment, access control modifier, Java class type,
superclass type, list of implemented interfaces,
and whether the class is abstract or final.
A class cannot be both abstract and final, so if both are
specified as true
, the class will be declared abstract.
The list should contain JavaType
objects representing each
interface that this class implements.
Strings will be converted, though, if it is more convenient to use Strings.
comment
- The class's descriptive comment.accessModifier
- The class's access control modifier.isAbstract
- true if the class is defined to be abstract.isFinal
- true if the class is defined to be final.className
- The class's Java type specification.superClassName
- The superclass Java type specification.implementedInterfaces
- The list of implemented interfaces.public JavaClassDefinition(String comment, String accessModifier, boolean isAbstract, boolean isFinal, boolean isStrict, String className, String superClassName, List implementedInterfaces)
JavaClassDefinition
with the specified
comment, access control modifier, class name,
superclass name, list of implemented interfaces,
whether the class is abstract or final,
and whether the object needs strictfp floating-point calculations.
A class cannot be both abstract and final, so if both are
specified as true
, the class will be declared abstract.
The list should contain JavaType
objects representing each
interface that this class implements.
Strings will be converted, though, if it is more convenient to use Strings.
comment
- The class's descriptive comment.accessModifier
- The class's access control modifier.isAbstract
- true if the class is defined to be abstract.isFinal
- true if the class is defined to be final.className
- The class name.superClassName
- The superclass name.implementedInterfaces
- The list of implemented interfaces.public JavaClassDefinition(String comment, JavaAccessModifier accessModifier, boolean isAbstract, boolean isFinal, boolean isStrict, JavaType className, JavaType superClassName, List implementedInterfaces)
JavaClassDefinition
with the specified
comment, access control modifier, Java class type,
superclass type, list of implemented interfaces,
whether the class is abstract or final,
and whether the object needs strictfp floating-point calculations.
A class cannot be both abstract and final, so if both are
specified as true
, the class will be declared abstract.
The list should contain JavaType
objects representing each
interface that this class implements.
Strings will be converted, though, if it is more convenient to use Strings.
comment
- The class's descriptive comment.accessModifier
- The class's access control modifier.isAbstract
- true if the class is defined to be abstract.isFinal
- true if the class is defined to be final.className
- The class's Java type specification.superClassName
- The superclass Java type specification.implementedInterfaces
- The list of implemented interfaces.Method Detail |
public boolean isAbstract()
isAbstract
in class JavaObjectDefinition
public void setAbstract(boolean value)
Note: Calling this method with true
will
set the value for isFinal
to false
.
value
- true for abstract.public boolean isFinal()
public void setFinal(boolean value)
Note: Calling this method with true
will
set the value for isAbstract
to false
.
value
- true for final.public String getPackageName()
public String getName()
public JavaType getSuperClass()
public String getSuperClassName()
public boolean isClassDefinition()
isClassDefinition
in class JavaObjectDefinition
public String getObjectKeyword()
JavaObjectDefinition
getObjectKeyword
in class JavaObjectDefinition
public List getImports()
JavaObjectDefinition
getImports
in class JavaObjectDefinition
public void writeDefinitionTo(CodeBuffer buffer)
JavaDefinition
CodeBuffer
.
writeDefinitionTo
in class JavaDefinition
buffer
- The CodeBuffer with which to append the data.CodeBuffer
|
Arch4J 1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |