com.ashridgetech.jamda.code
Class ClassWriter.MethodDetails

java.lang.Object
  |
  +--com.ashridgetech.jamda.code.ClassWriter.MethodDetails
Enclosing class:
ClassWriter

public static class ClassWriter.MethodDetails
extends java.lang.Object

Collects the details of a method in the code. Contains only set methods - the protected fields may be accessed by ClassWriter

See Also:
ClassWriter.beginMethod(com.ashridgetech.jamda.code.ClassWriter.MethodDetails)

Field Summary
protected  java.lang.String description
           
protected  java.util.List exceptionComments
           
protected  java.util.List exceptionNames
           
protected  boolean isForInterface
           
protected  int modifiers
           
protected  java.lang.String name
           
protected  java.util.List paramComments
           
protected  java.util.List paramNames
           
protected  java.util.List paramTypes
           
protected  java.lang.String returnComment
           
protected  java.lang.String returnTypeName
           
protected  java.util.List tags
           
 
Constructor Summary
ClassWriter.MethodDetails(java.lang.String name, boolean isForInterface)
          Create a MethodDetails with the given name, modifiers of PUBLIC, void return type and no parameters.
 
Method Summary
 ClassWriter.MethodDetails addModifiers(int modifiers)
          Add modifiers to the existing modifiers.
 ClassWriter.MethodDetails addTag(java.lang.String tag)
          Set an extra tag for the method Javadoc.
 ClassWriter.MethodDetails addThrows(java.lang.String exceptionName)
          Add the name of an exception thrown by this method, without a comment.
 ClassWriter.MethodDetails addThrows(java.lang.String exceptionName, java.lang.String exceptionComment)
          Add the name of an exception thrown by this method.
 ClassWriter.MethodDetails description(java.lang.String comment)
          Set the method description.
 int getModifiers()
          Get the existing modifiers.
protected  boolean hasDoc()
          Indicates whether this method has any documentation which needs a Javadoc comment.
 ClassWriter.MethodDetails param(java.lang.String type, java.lang.String name)
          Add a parameter with no description.
 ClassWriter.MethodDetails param(java.lang.String type, java.lang.String name, java.lang.String comment)
          Add a parameter.
 ClassWriter.MethodDetails removeAbstractModifier()
          Ensure this MethodDetails does not have the Modifier.ABSTRACT modifier.
 ClassWriter.MethodDetails returns(java.lang.String returnTypeName)
          Set the return type name.
 ClassWriter.MethodDetails returns(java.lang.String returnTypeName, java.lang.String comment)
          Set the return type name.
 ClassWriter.MethodDetails setModifiers(int modifiers)
          Replace the existing modifiers with modifiers.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

protected java.lang.String name

isForInterface

protected boolean isForInterface

returnTypeName

protected java.lang.String returnTypeName

returnComment

protected java.lang.String returnComment

modifiers

protected int modifiers

description

protected java.lang.String description

exceptionNames

protected java.util.List exceptionNames

exceptionComments

protected java.util.List exceptionComments

paramTypes

protected java.util.List paramTypes

paramNames

protected java.util.List paramNames

paramComments

protected java.util.List paramComments

tags

protected java.util.List tags
Constructor Detail

ClassWriter.MethodDetails

public ClassWriter.MethodDetails(java.lang.String name,
                                 boolean isForInterface)
Create a MethodDetails with the given name, modifiers of PUBLIC, void return type and no parameters.

Parameters:
name - the method name
isForInterface - true if this method is in an interface
Method Detail

hasDoc

protected boolean hasDoc()
Indicates whether this method has any documentation which needs a Javadoc comment.

Returns:
true if a comment is needed

returns

public ClassWriter.MethodDetails returns(java.lang.String returnTypeName)
Set the return type name.

Parameters:
returnTypeName - the name of the return type - may be null for no return type
Returns:
this instance

returns

public ClassWriter.MethodDetails returns(java.lang.String returnTypeName,
                                         java.lang.String comment)
Set the return type name.

Parameters:
returnTypeName - the name of the return type - may be null for no return type
comment - the description of the return type
Returns:
this instance

getModifiers

public int getModifiers()
Get the existing modifiers.

Returns:
the modifiers.

setModifiers

public ClassWriter.MethodDetails setModifiers(int modifiers)
Replace the existing modifiers with modifiers.

Parameters:
modifiers - the new modifiers.
Returns:
this instance

addModifiers

public ClassWriter.MethodDetails addModifiers(int modifiers)
Add modifiers to the existing modifiers.

Parameters:
modifiers - the modifiers to OR with the existing ones.
Returns:
this instance

removeAbstractModifier

public ClassWriter.MethodDetails removeAbstractModifier()
Ensure this MethodDetails does not have the Modifier.ABSTRACT modifier.

Returns:
this instance

description

public ClassWriter.MethodDetails description(java.lang.String comment)
Set the method description.

Parameters:
comment - the description of the method - may be null
Returns:
this instance

addThrows

public ClassWriter.MethodDetails addThrows(java.lang.String exceptionName)
Add the name of an exception thrown by this method, without a comment.

Parameters:
exceptionName - the name of the exception class
Returns:
this instance

addThrows

public ClassWriter.MethodDetails addThrows(java.lang.String exceptionName,
                                           java.lang.String exceptionComment)
Add the name of an exception thrown by this method.

Parameters:
exceptionName - the name of the exception class
exceptionComment - the reason for throwing the exception class - may be null if no @throws tag required
Returns:
this instance

addTag

public ClassWriter.MethodDetails addTag(java.lang.String tag)
Set an extra tag for the method Javadoc. This should not incluse the @param and @return tags, which are created from the comments supplied to returns(java.lang.String) and param(java.lang.String, java.lang.String, java.lang.String).

Parameters:
tag - the full text of the extra tag, such as "@see Widget#grumble"
Returns:
this instance

param

public ClassWriter.MethodDetails param(java.lang.String type,
                                       java.lang.String name,
                                       java.lang.String comment)
Add a parameter.

Parameters:
type - the name of the type of this parameter - must not be null
name - the name of this parameter - must not be null
comment - the description of this parameter - may be null if there is no comment
Returns:
this instance

param

public ClassWriter.MethodDetails param(java.lang.String type,
                                       java.lang.String name)
Add a parameter with no description.

Parameters:
type - the name of the type of this parameter - must not be null
name - the name of this parameter - must not be null
Returns:
this instance


Copyright © 2003 Ashridge Technologies Ltd. All Rights Reserved.