Class JConstructor
- java.lang.Object
-
- org.codehaus.modello.plugin.java.javasource.JConstructor
-
public class JConstructor extends java.lang.Object
A class for handling source code for a constructor of a JClass- Version:
- $Revision$ $Date$
-
-
Field Summary
Fields Modifier and Type Field Description private JAnnotations
annotations
private JClass
declaringClass
The Class in this JMember has been declaredprivate JModifiers
modifiers
The set of modifiers for this JMethodprivate java.util.Map<java.lang.String,JParameter>
params
List of parameters for this Constructorprivate JSourceCode
sourceCode
-
Constructor Summary
Constructors Constructor Description JConstructor(JClass declaringClass)
Creates a new method with the given name and returnType.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParameter(JParameter parameter)
Adds the given parameter to this Methods list of parametersvoid
appendAnnotation(java.lang.String annotation)
JAnnotations
getAnnotations()
JClass
getDeclaringClass()
Returns the class in which this JMember has been declaredJModifiers
getModifiers()
Returns the modifiers for this JConstructorJParameter[]
getParameters()
Returns an array of JParameters consisting of the parameters of this Method in declared orderJSourceCode
getSourceCode()
void
print(JSourceWriter jsw)
void
setAnnotations(JAnnotations annotations)
void
setModifiers(JModifiers modifiers)
void
setSourceCode(java.lang.String sourceCode)
void
setSourceCode(JSourceCode sourceCode)
java.lang.String
toString()
-
-
-
Field Detail
-
modifiers
private JModifiers modifiers
The set of modifiers for this JMethod
-
params
private java.util.Map<java.lang.String,JParameter> params
List of parameters for this Constructor
-
declaringClass
private JClass declaringClass
The Class in this JMember has been declared
-
sourceCode
private JSourceCode sourceCode
-
annotations
private JAnnotations annotations
-
-
Constructor Detail
-
JConstructor
public JConstructor(JClass declaringClass)
Creates a new method with the given name and returnType. For "void" return types, simply pass in null as the returnType- Parameters:
declaringClass
- the declaring class for this constructor
-
-
Method Detail
-
addParameter
public void addParameter(JParameter parameter) throws java.lang.IllegalArgumentException
Adds the given parameter to this Methods list of parameters- Parameters:
parameter
- the parameter to add to the this Methods list of parameters.- Throws:
java.lang.IllegalArgumentException
- when a parameter already exists for this Method with the same name as the new parameter
-
getDeclaringClass
public JClass getDeclaringClass()
Returns the class in which this JMember has been declared- Returns:
- the class in which this JMember has been declared
-
getModifiers
public JModifiers getModifiers()
Returns the modifiers for this JConstructor- Returns:
- the modifiers for this JConstructor
-
getParameters
public JParameter[] getParameters()
Returns an array of JParameters consisting of the parameters of this Method in declared order- Returns:
- a JParameter array consisting of the parameters of this Method in declared order
-
getSourceCode
public JSourceCode getSourceCode()
-
print
public void print(JSourceWriter jsw)
-
setModifiers
public void setModifiers(JModifiers modifiers)
-
setSourceCode
public void setSourceCode(java.lang.String sourceCode)
-
setSourceCode
public void setSourceCode(JSourceCode sourceCode)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getAnnotations
public JAnnotations getAnnotations()
- Returns:
- the annotations
-
appendAnnotation
public void appendAnnotation(java.lang.String annotation)
- Parameters:
annotation
- the annotation to append
-
setAnnotations
public void setAnnotations(JAnnotations annotations)
- Parameters:
annotations
- the annotations to set
-
-