Package org.exolab.javasource
Class JConstructor
- java.lang.Object
-
- org.exolab.javasource.JAnnotatedElementHelper
-
- org.exolab.javasource.JConstructor
-
- All Implemented Interfaces:
JAnnotatedElement
public final class JConstructor extends JAnnotatedElementHelper
A class for handling source code for a constructor of a JClass.- Version:
- $Revision: 8130 $ $Date: 2005-05-08 05:24:54 -0600 (Sun, 08 May 2005) $
- Author:
- Keith Visco
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JConstructor(AbstractJClass declaringClass)
Creates a new JConstructor for the provided declaring class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addException(JClass exp)
Adds the given Exception to this JConstructor's throws clause.void
addParameter(JParameter parameter)
Adds the given parameter to this JConstructor's list of parameters.AbstractJClass
getDeclaringClass()
Returns the class in which this JConstructor has been declared.JClass[]
getExceptions()
Returns the exceptions that this JConstructor lists in its throws clause.JModifiers
getModifiers()
Returns the modifiers for this JConstructor.int
getParameterCount()
Returns the amount of parameters.JParameter[]
getParameters()
Returns an array of JParameters consisting of the parameters of this JConstructor in declared order.JSourceCode
getSourceCode()
Returns the source code for this JConstructor.void
print(JSourceWriter jsw)
Prints this JConstructor to the provided JSourceWriter.void
setModifiers(JModifiers modifiers)
Sets the modifiers on this JConstructor.void
setSourceCode(java.lang.String sourceCode)
Sets the source code for this constructor.void
setSourceCode(JSourceCode sourceCode)
Sets the source code for this constructor.java.lang.String
toString()
-
Methods inherited from class org.exolab.javasource.JAnnotatedElementHelper
addAnnotation, getAnnotation, getAnnotations, hasAnnotations, isAnnotationPresent, printAnnotations, removeAnnotation
-
-
-
-
Constructor Detail
-
JConstructor
protected JConstructor(AbstractJClass declaringClass)
Creates a new JConstructor for the provided declaring class.- Parameters:
declaringClass
- The class this constructor creates.
-
-
Method Detail
-
getExceptions
public JClass[] getExceptions()
Returns the exceptions that this JConstructor lists in its throws clause.- Returns:
- The exceptions that this JConstructor lists in its throws clause.
-
addException
public void addException(JClass exp)
Adds the given Exception to this JConstructor's throws clause.- Parameters:
exp
- The JClass representing the Exception.
-
getParameters
public JParameter[] getParameters()
Returns an array of JParameters consisting of the parameters of this JConstructor in declared order.- Returns:
- A JParameter array consisting of the parameters of this JConstructor in declared order.
-
getParameterCount
public int getParameterCount()
Returns the amount of parameters.- Returns:
- The amount of parameters.
-
addParameter
public void addParameter(JParameter parameter)
Adds the given parameter to this JConstructor's list of parameters.- Parameters:
parameter
- The parameter to add to the this JConstructor's list of parameters.
-
getDeclaringClass
public AbstractJClass getDeclaringClass()
Returns the class in which this JConstructor has been declared.- Returns:
- The class in which this JConstructor has been declared.
-
getModifiers
public JModifiers getModifiers()
Returns the modifiers for this JConstructor.- Returns:
- The modifiers for this JConstructor.
-
setModifiers
public void setModifiers(JModifiers modifiers)
Sets the modifiers on this JConstructor.- Parameters:
modifiers
- Modifiers to set on this constructor.
-
getSourceCode
public JSourceCode getSourceCode()
Returns the source code for this JConstructor.- Returns:
- The source code.
-
setSourceCode
public void setSourceCode(java.lang.String sourceCode)
Sets the source code for this constructor.- Parameters:
sourceCode
- Source code to apply to this constructor.
-
setSourceCode
public void setSourceCode(JSourceCode sourceCode)
Sets the source code for this constructor.- Parameters:
sourceCode
- Source code to apply to this constructor.
-
print
public void print(JSourceWriter jsw)
Prints this JConstructor to the provided JSourceWriter.- Parameters:
jsw
- The JSourceWriter to print the constructor to.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-