org.cantaloop.cgimlet.lang.java
Class JConstructorTemplate
java.lang.Object
|
+--org.cantaloop.cgimlet.lang.java.AbstractTemplate
|
+--org.cantaloop.cgimlet.lang.java.JConstructorTemplate
- All Implemented Interfaces:
- ConstructorTemplate, Template
- Direct Known Subclasses:
- JMethodTemplate
- public class JConstructorTemplate
- extends AbstractTemplate
- implements ConstructorTemplate
- Version:
- 0.2.0 ($Revision: 1.4 $)
- Author:
- David Leuschner, Stefan Heimann
Method Summary |
void |
addParameter(Type type,
java.lang.String name)
Adds a parameter to the parameter list. |
void |
append(java.lang.String s)
Append some code to the body. |
void |
append(java.lang.String s,
java.lang.String a1)
Convinience method equivalent to
append(s, new String[] { a1 }); . |
void |
append(java.lang.String s,
java.lang.String[] args)
Invokes CGUtils.sprintf(String,String[])
with the given arguments and appends the result to the body. |
void |
append(java.lang.String s,
java.lang.String a1,
java.lang.String a2)
Convinience method equivalent to
append(s, new String[] { a1, a2 }); . |
void |
append(java.lang.String s,
java.lang.String a1,
java.lang.String a2,
java.lang.String a3)
Convinience method equivalent to
append(s, new String[] { a1, a2, a3 }); . |
MethodTemplate |
createHelperMethod()
Creates a new helper method. |
java.lang.String |
getBody()
|
java.lang.String |
getCode()
Returns the code for this template. |
protected java.lang.String |
getHelperMethodName()
|
java.lang.String |
parameterToString()
Returns a textual representation of the parameters. |
void |
setBody(java.lang.String s)
Set the body of the constructor. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_params
protected java.util.List m_params
m_body
protected java.lang.StringBuffer m_body
m_helperMethods
protected java.util.Set m_helperMethods
JConstructorTemplate
protected JConstructorTemplate(java.lang.String name)
createHelperMethod
public MethodTemplate createHelperMethod()
- Description copied from interface:
ConstructorTemplate
- Creates a new helper method. The helper method is automatically
generated when its `parent' (this class) is generated.
- Specified by:
createHelperMethod
in interface ConstructorTemplate
getHelperMethodName
protected java.lang.String getHelperMethodName()
addParameter
public void addParameter(Type type,
java.lang.String name)
- Description copied from interface:
ConstructorTemplate
- Adds a parameter to the parameter list.
- Specified by:
addParameter
in interface ConstructorTemplate
setBody
public void setBody(java.lang.String s)
- Description copied from interface:
ConstructorTemplate
- Set the body of the constructor.
- Specified by:
setBody
in interface ConstructorTemplate
getBody
public java.lang.String getBody()
- Specified by:
getBody
in interface ConstructorTemplate
append
public void append(java.lang.String s)
- Description copied from interface:
ConstructorTemplate
- Append some code to the body.
- Specified by:
append
in interface ConstructorTemplate
append
public void append(java.lang.String s,
java.lang.String[] args)
- Description copied from interface:
ConstructorTemplate
- Invokes
CGUtils.sprintf(String,String[])
with the given arguments and appends the result to the body.
- Specified by:
append
in interface ConstructorTemplate
append
public void append(java.lang.String s,
java.lang.String a1)
- Description copied from interface:
ConstructorTemplate
- Convinience method equivalent to
append(s, new String[] { a1 });
.
- Specified by:
append
in interface ConstructorTemplate
append
public void append(java.lang.String s,
java.lang.String a1,
java.lang.String a2)
- Description copied from interface:
ConstructorTemplate
- Convinience method equivalent to
append(s, new String[] { a1, a2 });
.
- Specified by:
append
in interface ConstructorTemplate
append
public void append(java.lang.String s,
java.lang.String a1,
java.lang.String a2,
java.lang.String a3)
- Description copied from interface:
ConstructorTemplate
- Convinience method equivalent to
append(s, new String[] { a1, a2, a3 });
.
- Specified by:
append
in interface ConstructorTemplate
parameterToString
public java.lang.String parameterToString()
- Description copied from interface:
ConstructorTemplate
- Returns a textual representation of the parameters.
- Specified by:
parameterToString
in interface ConstructorTemplate
getCode
public java.lang.String getCode()
- Description copied from interface:
Template
- Returns the code for this template.
- Specified by:
getCode
in interface Template