com.bowstreet.webapp
Interface ClassInfo

All Superinterfaces:
ClassItem, IExemplar, WebAppObject

public interface ClassInfo
extends WebAppObject, ClassItem

Interface to hold metadata about a Java class. This class can be use by the builders to generate a Java class source file. Then the ClassInfo can be written out as a Java source file.


Field Summary
static int ACTION_CLASS
           
static int BEAN_CLASS
           
static java.lang.String GENERATED_BODY_BEGIN_PREFIX
           
static java.lang.String GENERATED_BODY_BEGIN_SUFFIX
           
static java.lang.String GENERATED_BODY_END
           
static java.lang.String GENERATED_PLACEHOLDER_PREFIX
           
static java.lang.String GENERATED_PLACEHOLDER_SUFFIX
           
 
Fields inherited from interface com.bowstreet.webapp.WebAppObject
ALWAYS_VISIBLE, INFORMATION_PROPERTY, NEVER_VISIBLE, SOMETIMES_VISIBLE
 
Method Summary
 Method addConstructor(java.lang.String name)
          Adds a constructor method (Method) to the class.
 void addImplements(java.lang.String implementsName)
          Adds a name to the names that this class implements.
 void addImport(java.lang.String name)
          Adds a java import statement to this class.
 Initializer addInitializer()
          Adds a initializer (Initializer) to the class.
 ClassInfo addInnerClass(java.lang.String name)
          Constructs a ClassInfo and adds it as an inner class.
 Member addMember(java.lang.String name, java.lang.String type, java.lang.String modifier)
          Adds a data member to this class with no default value.
 Member addMember(java.lang.String name, java.lang.String type, java.lang.String modifier, java.lang.String defaultValue)
          Adds a data member to this class with a specified default value.
 Method addMethod(java.lang.String name)
          Adds a method (MethodInfo) to the class.
 java.lang.String getClassName()
          Gets the java class name including its package.
 int getClassType()
          Gets the type of this class.
 java.lang.String getDescription()
          Gets the comment at top of file (i.e. above the package declaration).
 java.lang.String getExtends()
          Gets the name that the class extends.
 java.util.Iterator getImplements()
          Gets an Iterator of interface names this class implements.
 java.util.Iterator getImports()
          Gets an iterator of the imports of this class.
 java.util.Iterator getInitializers()
          Gets an Iterator of all the initializers on the class.
 ClassInfo getInnerClass(java.lang.String name)
          Gets the specified inner class(ClassInfo) on this class.
 java.util.Iterator getInnerClasses()
          Gets an iterator of the inner classes.
 java.util.Iterator getMembers()
          Gets an Iterator of all the data members of the class.
 Method getMethod(java.lang.String name)
          Gets the specified method(Method) on this class.
 java.util.Iterator getMethods()
          Gets an Iterator of all the methods on the class.
 java.lang.String getModifier()
          Returns the modifier.
 java.lang.String getPackage()
          Returns the packageName.
 boolean isInterface()
          Gets if this ClassInfo describes an interface.
 void setClassName(java.lang.String className)
          Sets the java class name including its package.
 void setClassType(int classType)
          Sets the type of this class.
 void setDescription(java.lang.String description)
          Sets the comment at top of file (i.e. above the package declaration).
 void setExtends(java.lang.String extendsName)
          Sets the name that the class extends.
 void setInterface(boolean isInterface)
          Sets if this ClassInfo describes an interface.
 void setModifier(java.lang.String modifier)
          Sets the modifier.
 java.lang.String toString()
          Gets a String of the entire class source.
 void write(java.io.Writer writer)
          Writes the entire class source to the specified Writer.
 
Methods inherited from interface com.bowstreet.webapp.WebAppObject
clone, getBuilderCall, getName, getProperties, getProperty, getVisibility, isHidden, putProperty, setBuilderCall, setHidden, setName, setVisibility
 
Methods inherited from interface com.bowstreet.util.IExemplar
newInstance
 
Methods inherited from interface com.bowstreet.webapp.ClassItem
getComment, isGenerated, setComment, setGenerated, write
 

Field Detail

ACTION_CLASS

static final int ACTION_CLASS
See Also:
Constant Field Values

BEAN_CLASS

static final int BEAN_CLASS
See Also:
Constant Field Values

GENERATED_BODY_BEGIN_PREFIX

static final java.lang.String GENERATED_BODY_BEGIN_PREFIX
See Also:
Constant Field Values

GENERATED_BODY_BEGIN_SUFFIX

static final java.lang.String GENERATED_BODY_BEGIN_SUFFIX
See Also:
Constant Field Values

GENERATED_BODY_END

static final java.lang.String GENERATED_BODY_END
See Also:
Constant Field Values

GENERATED_PLACEHOLDER_PREFIX

static final java.lang.String GENERATED_PLACEHOLDER_PREFIX
See Also:
Constant Field Values

GENERATED_PLACEHOLDER_SUFFIX

static final java.lang.String GENERATED_PLACEHOLDER_SUFFIX
See Also:
Constant Field Values
Method Detail

addConstructor

Method addConstructor(java.lang.String name)
Adds a constructor method (Method) to the class. Same as add Method except the method is added to beginning of list and has no return type.

Parameters:
name - The name of the method to add.
Returns:
The created Method object, which can be further modified.

addImplements

void addImplements(java.lang.String implementsName)
Adds a name to the names that this class implements.

Parameters:
implementsName - The interface name to add.

addImport

void addImport(java.lang.String name)
Adds a java import statement to this class. Example: "java.util.*"

Parameters:
name - The name of the import (e.g. "java.util.*").

addInitializer

Initializer addInitializer()
Adds a initializer (Initializer) to the class.

Returns:
The created Initializer object, which can be further modified.

addInnerClass

ClassInfo addInnerClass(java.lang.String name)
Constructs a ClassInfo and adds it as an inner class.

Parameters:
name - The name of the ClassInfo to add, which is used to reference it in a collection of inner ClassInfo objects. This name does not necessarily need to match the actual class name.

addMember

Member addMember(java.lang.String name,
                 java.lang.String type,
                 java.lang.String modifier)
Adds a data member to this class with no default value.

Parameters:
name - The name of the member.
type - The java data type (e.g. String, File).
modifier - A java modifier (e.g. private).
Returns:
The created Member object, which can be further modified.

addMember

Member addMember(java.lang.String name,
                 java.lang.String type,
                 java.lang.String modifier,
                 java.lang.String defaultValue)
Adds a data member to this class with a specified default value.

Parameters:
name - The name of the member.
type - The java data type (e.g. String, File).
modifier - A java modifier (e.g. private).
defaultValue - A default value to set the member to.
Returns:
The created Member object, which can be further modified.

addMethod

Method addMethod(java.lang.String name)
Adds a method (MethodInfo) to the class.

Parameters:
name - The name of the method to add.
Returns:
The created Method object, which can be further modified.

getClassName

java.lang.String getClassName()
Gets the java class name including its package.

Returns:
The java class name including its package (e.g. com.bowstreet.MyClass).

getClassType

int getClassType()
Gets the type of this class. For informational use only.

Returns:
The type of this class.

getDescription

java.lang.String getDescription()
Gets the comment at top of file (i.e. above the package declaration).

Returns:
The comment at top of file.

getExtends

java.lang.String getExtends()
Gets the name that the class extends.

Returns:
The name that the class extends, or null it it does not extend a parent class.

getImplements

java.util.Iterator getImplements()
Gets an Iterator of interface names this class implements.

Returns:
Iterator Iterator of interface names this class implements.

getImports

java.util.Iterator getImports()
Gets an iterator of the imports of this class.

Returns:
Iterator of imports(Strings) for this class in the form of "java.util.*".

getInitializers

java.util.Iterator getInitializers()
Gets an Iterator of all the initializers on the class.

Returns:
An Iterator of Initializer objects for the class.

getInnerClass

ClassInfo getInnerClass(java.lang.String name)
Gets the specified inner class(ClassInfo) on this class.

Parameters:
name - The inner class to get.
Returns:
The ClassInfo object if found, else null.

getInnerClasses

java.util.Iterator getInnerClasses()
Gets an iterator of the inner classes.

Returns:
Iterator of inner classes(ClassInfo) for this class.

getMembers

java.util.Iterator getMembers()
Gets an Iterator of all the data members of the class.

Returns:
An Iterator of Member objects for the class.

getMethod

Method getMethod(java.lang.String name)
Gets the specified method(Method) on this class.

Parameters:
name - The Method to get.
Returns:
The Method object if found, else null.

getMethods

java.util.Iterator getMethods()
Gets an Iterator of all the methods on the class.

Returns:
An Iterator of MethodInfo objects for the class.

getModifier

java.lang.String getModifier()
Returns the modifier.

Specified by:
getModifier in interface ClassItem
Returns:
String

getPackage

java.lang.String getPackage()
Returns the packageName.

Returns:
String

isInterface

boolean isInterface()
Gets if this ClassInfo describes an interface.

Returns:
true if this is an interface, else false if class.

setClassName

void setClassName(java.lang.String className)
Sets the java class name including its package.

Parameters:
className - The java class name including its package (e.g. com.bowstreet.MyClass).

setClassType

void setClassType(int classType)
Sets the type of this class. For informational use only.

Parameters:
classType - The type of this class.

setDescription

void setDescription(java.lang.String description)
Sets the comment at top of file (i.e. above the package declaration).

Parameters:
description - The comment at top of file.

setExtends

void setExtends(java.lang.String extendsName)
Sets the name that the class extends.

Parameters:
extendsName - The name that the class extends.

setInterface

void setInterface(boolean isInterface)
Sets if this ClassInfo describes an interface.

Parameters:
isInterface - true if this is an interface, else false.

setModifier

void setModifier(java.lang.String modifier)
Sets the modifier.

Parameters:
modifier - The modifier to set

toString

java.lang.String toString()
Gets a String of the entire class source.

Overrides:
toString in class java.lang.Object

write

void write(java.io.Writer writer)
           throws java.io.IOException
Writes the entire class source to the specified Writer.

Throws:
java.io.IOException


Copyright © 2009 IBM. All Rights Reserved.