com.objectwave.sourceModel
Class MethodDef

java.lang.Object
  |
  +--com.objectwave.sourceModel.CommonDef
        |
        +--com.objectwave.sourceModel.MethodDef
All Implemented Interfaces:
ClassElement

public class MethodDef
extends CommonDef

MetaModel representation of a MethodDefinition. This class is largely a holder of data about a method definition. The MethodDefParser is responsible for creating instances of this object. There is very little behavior in this class.

Version:
$Id: MethodDef.java,v 2.0 2001/06/11 15:54:25 dave_hoag Exp $
Author:
Dave Hoag
See Also:
CommonDef, MethodDefParser

Nested Class Summary
static class MethodDef.Test
          Unit test for this class.
 
Field Summary
 
Fields inherited from class com.objectwave.sourceModel.CommonDef
collectionTypes
 
Constructor Summary
MethodDef()
           
 
Method Summary
 void addException(java.lang.String except)
          Add the String identified by the parameter as an exception thrown by this method.
 void changeComment(java.lang.String newValue)
          Side effect of changing the 'fullText' attribute for this object.
 MethodDef cloneSignature()
          Create a copy of this method with a empty body implementation.
 MethodDef cloneSignature(java.lang.String newBody)
          Useful for copying the signature Since all interface methods are abstract, and that is a common method def we would like to clone, the abstract portion of the signature is dropped.
 void dumpObject()
           
 boolean equals(java.lang.Object element)
          A MethodDef is equal if it has the exact same signature.
 java.lang.String[] getArgumentTypes()
          Just string values of the argument types.
 java.lang.String getComment()
           
 java.util.Vector getExceptions()
           
 java.lang.String getMethodText()
          This is the information within the { }.
 MethodParameter[] getParameters()
          A method will likely have parameters.
 boolean isAbstractMeth()
          Gets the AbstractMeth attribute of the MethodDef object
 boolean isConstructor()
          Gets the Constructor attribute of the MethodDef object
 boolean isNativeMeth()
          Gets the NativeMeth attribute of the MethodDef object
 java.lang.String listEntry()
          Description of the Method
 void setAbstractMeth(boolean aValue)
          Sets the AbstractMeth attribute of the MethodDef object
 void setArgumentTypes(java.lang.String[] strArr)
          Just string values of the argument types.
 void setComment(java.lang.String newValue)
           
 void setConstructor(boolean b)
          Sets the Constructor attribute of the MethodDef object
 void setExceptions(java.util.Vector v)
          Vector containing the exceptions declared for this method.
 void setMethodText(java.lang.String aValue)
          This is the information within the { }.
 void setName(java.lang.String aName)
          The identifier for this method.
 void setNativeMeth(boolean aValue)
          Is this method a native method?
 void setParameters(MethodParameter[] paramArr)
          A method will likely have parameters.
 java.lang.String shortString()
           
 
Methods inherited from class com.objectwave.sourceModel.CommonDef
getChildElements, getFullText, getFullTextNoChild, getName, getScope, getType, hasChildElements, isCollection, isFinal, isNativeArray, isStatic, setFinal, setFullText, setNativeArray, setScope, setStatic, setType
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MethodDef

public MethodDef()
Method Detail

setExceptions

public void setExceptions(java.util.Vector v)
Vector containing the exceptions declared for this method.

Parameters:
v - The new Exceptions value

setAbstractMeth

public void setAbstractMeth(boolean aValue)
Sets the AbstractMeth attribute of the MethodDef object

Parameters:
aValue - The new AbstractMeth value

setArgumentTypes

public void setArgumentTypes(java.lang.String[] strArr)
Just string values of the argument types. These come from the MethodParameter objects.

Parameters:
strArr - The new ArgumentTypes value

setComment

public void setComment(java.lang.String newValue)
Parameters:
newValue - java.lang.String

setConstructor

public void setConstructor(boolean b)
Sets the Constructor attribute of the MethodDef object

Parameters:
b - The new Constructor value

setMethodText

public void setMethodText(java.lang.String aValue)
This is the information within the { }.

Parameters:
aValue - The new MethodText value

setName

public void setName(java.lang.String aName)
The identifier for this method.

Overrides:
setName in class CommonDef
Parameters:
aName - The new Name value

setNativeMeth

public void setNativeMeth(boolean aValue)
Is this method a native method?

Parameters:
aValue - The new NativeMeth value

setParameters

public void setParameters(MethodParameter[] paramArr)
A method will likely have parameters. These are encapsulated into MethodParameter objects.

Parameters:
paramArr - The new Parameters value
See Also:
MethodParameter

getExceptions

public java.util.Vector getExceptions()
Returns:
Vector containing the exceptions declared for this method.

getArgumentTypes

public java.lang.String[] getArgumentTypes()
Just string values of the argument types. These come from the MethodParameter objects.

Returns:
The ArgumentTypes value

getComment

public java.lang.String getComment()
Returns:
java.lang.String

getMethodText

public java.lang.String getMethodText()
This is the information within the { }.

Returns:
The MethodText value

getParameters

public MethodParameter[] getParameters()
A method will likely have parameters. These are encapsulated into MethodParameter objects.

Returns:
The Parameters value
See Also:
MethodParameter

isAbstractMeth

public boolean isAbstractMeth()
Gets the AbstractMeth attribute of the MethodDef object

Returns:
The AbstractMeth value

isConstructor

public boolean isConstructor()
Gets the Constructor attribute of the MethodDef object

Returns:
The Constructor value

isNativeMeth

public boolean isNativeMeth()
Gets the NativeMeth attribute of the MethodDef object

Returns:
The NativeMeth value

addException

public void addException(java.lang.String except)
Add the String identified by the parameter as an exception thrown by this method.

Parameters:
except - The feature to be added to the Exception attribute

cloneSignature

public MethodDef cloneSignature()
Create a copy of this method with a empty body implementation. Any references to 'abstract' will be dropped since this is intended to create implementations.

Returns:
com.objectwave.sourceModel.MethodDef

cloneSignature

public MethodDef cloneSignature(java.lang.String newBody)
Useful for copying the signature Since all interface methods are abstract, and that is a common method def we would like to clone, the abstract portion of the signature is dropped.

Parameters:
newBody - The body of the method.
Returns:
Description of the Returned Value

changeComment

public void changeComment(java.lang.String newValue)
Side effect of changing the 'fullText' attribute for this object. Useful for quick source generation.

Parameters:
newValue - java.lang.String

dumpObject

public void dumpObject()
Specified by:
dumpObject in interface ClassElement
Overrides:
dumpObject in class CommonDef

equals

public boolean equals(java.lang.Object element)
A MethodDef is equal if it has the exact same signature. Perhaps this should change to only return true for those cases that would provide a compiler error (more method defs would likely be equal)

Overrides:
equals in class CommonDef
Parameters:
element - The object with which to compare this.
Returns:
Description of the Returned Value

listEntry

public java.lang.String listEntry()
Description of the Method

Returns:
Description of the Returned Value

shortString

public java.lang.String shortString()
Returns:
Description of the Returned Value