Cantaloop CGimlet - API Documentation, Version: 0.2.0, Date: 2002-05-13 21:30 CEST

org.cantaloop.cgimlet.lang.java
Class JClassTemplate

java.lang.Object
  |
  +--org.cantaloop.cgimlet.lang.java.AbstractTemplate
        |
        +--org.cantaloop.cgimlet.lang.java.JClassTemplate
All Implemented Interfaces:
ClassTemplate, Template

public class JClassTemplate
extends AbstractTemplate
implements ClassTemplate

This template that can be used to generate a class.

Version:
0.2.0 ($Revision: 1.4 $)
Author:
David Leuschner, Stefan Heimann

Field Summary
protected  java.util.Set m_constructors
           
protected  java.util.Set m_fields
           
protected  java.util.Set m_ifaces
           
protected  java.util.Set m_imports
           
protected  java.util.Set m_memberClasses
           
protected  java.util.Set m_methods
           
protected  java.lang.String m_parent
           
protected  java.lang.String m_pkg
           
 
Fields inherited from class org.cantaloop.cgimlet.lang.java.AbstractTemplate
DESCR, m_modifier, m_name, UTILS
 
Constructor Summary
JClassTemplate(java.lang.String pkg, java.lang.String name)
           
 
Method Summary
 ConstructorTemplate addConstructor()
          Creates a constructor for this class
 void addField(FieldTemplate f)
          Adds a field.
 void addImport(java.lang.String name)
          Adds a class or a package that should be imported.
 void addInterface(java.lang.String iface)
          Adds the (fully qualified) name of a interface to the list of interfaces this class implements.
 org.cantaloop.cgimlet.lang.java.MemberClassTemplate addMemberClass(java.lang.String name, Modifier m)
           
 void addMethod(MethodTemplate m)
          Adds a method.
 java.lang.String getCode()
          Returns the code for this template.
 java.lang.String getFullyQualifiedName()
          Get the fully qualified name of the class
 java.lang.String getPackage()
          Get the package the class is contained in.
protected  void internGetClassDeclaration(java.lang.StringBuffer sb)
          Returns the declaration of the class.
 void setParent(java.lang.String parent)
          Sets the name of the parent class (you must specify the fully qualified name if it is not in the same package).
 
Methods inherited from class org.cantaloop.cgimlet.lang.java.AbstractTemplate
getModifier, getName, setModifier
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.cantaloop.cgimlet.lang.ClassTemplate
getName
 

Field Detail

m_parent

protected java.lang.String m_parent

m_pkg

protected java.lang.String m_pkg

m_ifaces

protected java.util.Set m_ifaces

m_imports

protected java.util.Set m_imports

m_fields

protected java.util.Set m_fields

m_methods

protected java.util.Set m_methods

m_constructors

protected java.util.Set m_constructors

m_memberClasses

protected java.util.Set m_memberClasses
Constructor Detail

JClassTemplate

public JClassTemplate(java.lang.String pkg,
                      java.lang.String name)
Method Detail

getFullyQualifiedName

public java.lang.String getFullyQualifiedName()
Description copied from interface: ClassTemplate
Get the fully qualified name of the class
Specified by:
getFullyQualifiedName in interface ClassTemplate

setParent

public void setParent(java.lang.String parent)
Description copied from interface: ClassTemplate
Sets the name of the parent class (you must specify the fully qualified name if it is not in the same package).
Specified by:
setParent in interface ClassTemplate

getPackage

public java.lang.String getPackage()
Description copied from interface: ClassTemplate
Get the package the class is contained in.
Specified by:
getPackage in interface ClassTemplate

addInterface

public void addInterface(java.lang.String iface)
Description copied from interface: ClassTemplate
Adds the (fully qualified) name of a interface to the list of interfaces this class implements.
Specified by:
addInterface in interface ClassTemplate
Following copied from interface: org.cantaloop.cgimlet.lang.ClassTemplate
Parameters:
iface - a String value

addImport

public void addImport(java.lang.String name)
Description copied from interface: ClassTemplate
Adds a class or a package that should be imported.
Specified by:
addImport in interface ClassTemplate
Following copied from interface: org.cantaloop.cgimlet.lang.ClassTemplate
Parameters:
pkg - a String value

addField

public void addField(FieldTemplate f)
Description copied from interface: ClassTemplate
Adds a field.
Specified by:
addField in interface ClassTemplate
Following copied from interface: org.cantaloop.cgimlet.lang.ClassTemplate
Parameters:
f - a FieldTemplate value

addMethod

public void addMethod(MethodTemplate m)
Description copied from interface: ClassTemplate
Adds a method.
Specified by:
addMethod in interface ClassTemplate
Following copied from interface: org.cantaloop.cgimlet.lang.ClassTemplate
Parameters:
m - a MethodTemplate value

addConstructor

public ConstructorTemplate addConstructor()
Description copied from interface: ClassTemplate
Creates a constructor for this class
Specified by:
addConstructor in interface ClassTemplate
Following copied from interface: org.cantaloop.cgimlet.lang.ClassTemplate
Returns:
a ConstructorTemplate value

addMemberClass

public org.cantaloop.cgimlet.lang.java.MemberClassTemplate addMemberClass(java.lang.String name,
                                                                          Modifier m)

getCode

public java.lang.String getCode()
Description copied from interface: Template
Returns the code for this template.
Specified by:
getCode in interface Template

internGetClassDeclaration

protected void internGetClassDeclaration(java.lang.StringBuffer sb)
Returns the declaration of the class. The declaration of a class is the access modifier, other modifiers like final or static and the name of the class. Subclasses may override this method.
Parameters:
sb - the StringBuffer to write the code to.

Copyright 2001, 2002 Stefan Heimann, David Leuschner. All rights reserved.