Arch4J generator 1.1

org.arch4j.generator
Class JavaDefinition

java.lang.Object
  |
  +--org.arch4j.generator.JavaDefinition
Direct Known Subclasses:
JavaFieldDefinition, JavaFunctionDefinition, JavaObjectDefinition

public abstract class JavaDefinition
extends Object

This class is used to define a set of attributes common to many parts of a Java source file. This class is declared abstract, so subclasses may implement different parts of a Java source file. An instance of one of these subclasses is an atomic definition for one part of a Java source file, such as a method, constructor, or field.

Version:
1.0
Author:
Ross E. Greinke

Field Summary
protected  JavaAccessModifier accessModifier
          The access control modifier.
protected  String comment
          A descriptive line of comments.
 
Constructor Summary
JavaDefinition(String comment, JavaAccessModifier accessModifier)
          Constructs a JavaDefinition with the specified comment and access control modifier.
JavaDefinition(String comment, String accessModifier)
          Constructs a JavaDefinition with the specified comment and access control modifier.
 
Method Summary
 JavaAccessModifier getAccessModifier()
          Returns the access control modifier.
 String getComment()
          Returns the comment.
 String getDefinition()
          Returns a String containing the Java source representation of the definition.
abstract  List getImports()
          Returns a list of potential import types for the definition.
 boolean hasComment()
          Returns whether the definition has a comment or not.
protected  void setAccessModifier(JavaAccessModifier newModifier)
          Set the access control modifier.
 void setComment(String newComment)
          Set the comment.
abstract  void writeDefinitionTo(CodeBuffer buffer)
          Write the Java source representation of the definition to the CodeBuffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

comment

protected String comment
A descriptive line of comments. Can be null.


accessModifier

protected JavaAccessModifier accessModifier
The access control modifier. Default = package access.

Constructor Detail

JavaDefinition

public JavaDefinition(String comment,
                      String accessModifier)
Constructs a JavaDefinition with the specified comment and access control modifier.

Parameters:
comment - The definition's comment.
accessModifier - The definition's access control modifier.

JavaDefinition

public JavaDefinition(String comment,
                      JavaAccessModifier accessModifier)
Constructs a JavaDefinition with the specified comment and access control modifier.

Parameters:
comment - The definition's comment.
accessModifier - The definition's access control modifier.
Method Detail

getComment

public String getComment()
Returns the comment.

Returns:
The comment.

setComment

public void setComment(String newComment)
Set the comment.

Parameters:
newComment - The comment.

hasComment

public boolean hasComment()
Returns whether the definition has a comment or not.

Returns:
true if the definition has a comment.

getAccessModifier

public JavaAccessModifier getAccessModifier()
Returns the access control modifier.

Returns:
The access control modifier.

setAccessModifier

protected void setAccessModifier(JavaAccessModifier newModifier)
Set the access control modifier. If a null modifier is given, access control will be set to package access.

Parameters:
newModifier - The access control modifier.

getDefinition

public String getDefinition()
Returns a String containing the Java source representation of the definition.

Returns:
A String containing the Java source representation of the definition.

getImports

public abstract List getImports()
Returns a list of potential import types for the definition. It should be a List of JavaType objects.

Returns:
A list of potential import types for the definition.

writeDefinitionTo

public abstract void writeDefinitionTo(CodeBuffer buffer)
Write the Java source representation of the definition to the CodeBuffer.

Parameters:
buffer - The CodeBuffer with which to append the data.
See Also:
CodeBuffer

Arch4J generator 1.1

Copyright © 2000-2004 SpiderLogic, a service of Wipfli Ullrich Bertelson LLP.