xjavadoc
Class MethodImpl

java.lang.Object
  extended byxjavadoc.AbstractProgramElement
      extended byxjavadoc.MemberImpl
          extended byxjavadoc.AbstractExecutableMember
              extended byxjavadoc.MethodImpl
All Implemented Interfaces:
java.lang.Comparable, Named, XExecutableMember, XMember, XMethod, XProgramElement

final class MethodImpl
extends AbstractExecutableMember
implements XMethod

Describe what this class does

Author:
Aslak Hellesøy

Nested Class Summary
 
Nested classes inherited from class xjavadoc.XMethod
XMethod.PropertyAccessorPredicate, XMethod.PropertyMutatorPredicate
 
Field Summary
private  ReturnType _returnType
           
static int instanceCount
           
private  java.lang.String methodNameWithSignatureAndModifiers
           
private  java.lang.String methodNameWithSignatureWithoutModifiers
           
 
Fields inherited from class xjavadoc.AbstractProgramElement
EMPTY_LIST
 
Fields inherited from interface xjavadoc.XMethod
PROPERTY_ACCESSOR_PREDICATE, PROPERTY_MUTATOR_PREDICATE
 
Constructor Summary
MethodImpl(AbstractClass containingClass, XTagFactory tagFactory)
           
 
Method Summary
 void addParameterData(java.lang.String type, java.lang.String name, int dimension)
          Adds a parameter
 void addThrownException(java.lang.String thrownException)
           
protected  java.lang.String buildStringId()
           
 boolean equals(java.lang.Object o)
          Two methods are equal if they have the same return type, name and signature, regardless of the enclosing class and modifiers.
 XMethod getAccessor()
          If this method is a mutator, and a corresponding accessor exists, that accessor will be returned.
private  java.lang.String getMethodNameWithSignatureAndModifiers()
           
private  java.lang.String getMethodNameWithSignatureWithoutModifiers()
           
 XMethod getMutator()
          If this method is an accessor, and a corresponding mutator exists, that mutator will be returned.
 java.lang.String getName()
          Get name
 java.lang.String getNameWithoutPrefix()
          Returns the name of the method with the prefix stripped away.
 java.lang.String getNameWithSignature(boolean withParam)
          Gets the name and signature
(package private)  int getParameterDimension(int index)
           
(package private)  java.lang.String getParameterName(int index)
           
 java.util.List getParameters()
          Returns the method parameters.
(package private)  java.lang.String getParameterType(int index)
           
 java.lang.String getParameterTypes()
          Returns the parameters as a comma separated list of classes.
 java.lang.String getPropertyName()
          Returns the property name of this method (if it is an accessor or mutator), or null if it is not.
 Type getPropertyType()
          Returns the type of the property this method represents, or null if this method is not a property method.
 Type getReturnType()
          Returns the return type of the method.
 java.lang.String getSignature(boolean withParam)
          Gets the signature
 XProgramElement getSuperElement()
           
 XProgramElement getSuperElement(boolean forMethod)
           
 java.util.List getSuperInterfaceElements()
           
 java.util.List getThrownExceptions()
          Returns the thrown exception classes.
 int hashCode()
           
 boolean isConstructor()
          Gets the Constructor attribute of the SourceMethod object
 boolean isNative()
          Gets the Native attribute of the AbstractExecutableMember object
 boolean isPropertyAccessor()
           
 boolean isPropertyMutator()
           
 boolean isSynchronized()
          Gets the Synchronized attribute of the AbstractExecutableMember object
 void setName(java.lang.String name)
           
 void setReturnDimension(int d)
          Sets the ReturnDimension attribute of the SourceMethod object
 void setReturnType(java.lang.String returnType)
          Sets the ReturnType attribute of the SourceMethod object
 boolean throwsException(java.lang.String exception_class_name)
          Return true if the member throws the specified exception in its throws block.
 java.lang.String toString()
           
private  java.lang.String toString(boolean modifiers)
          Builds a String uniquely describing this method
 
Methods inherited from class xjavadoc.AbstractProgramElement
addModifier, compareTo, getContainingAbstractClass, getContainingClass, getContainingPackage, getDoc, getModifiers, getModifierSpecifier, getTagFactory, getXJavaDoc, isAbstract, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, reset, setToken, updateDoc
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface xjavadoc.XExecutableMember
getNameWithSignature, getParameters, getParameterTypes, getSignature, getThrownExceptions, isNative, isSynchronized, throwsException
 
Methods inherited from interface xjavadoc.XProgramElement
getContainingClass, getContainingPackage, getDoc, getModifiers, getModifierSpecifier, getXJavaDoc, isAbstract, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, updateDoc
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface xjavadoc.Named
getName
 

Field Detail

instanceCount

public static int instanceCount

methodNameWithSignatureAndModifiers

private java.lang.String methodNameWithSignatureAndModifiers

methodNameWithSignatureWithoutModifiers

private java.lang.String methodNameWithSignatureWithoutModifiers

_returnType

private ReturnType _returnType
Constructor Detail

MethodImpl

public MethodImpl(AbstractClass containingClass,
                  XTagFactory tagFactory)
Method Detail

isConstructor

public final boolean isConstructor()
Gets the Constructor attribute of the SourceMethod object

Specified by:
isConstructor in interface XExecutableMember
Returns:
The Constructor value

getReturnType

public final Type getReturnType()
Description copied from interface: XMethod
Returns the return type of the method.

Specified by:
getReturnType in interface XMethod
Returns:
the return type of the method.

getSuperElement

public XProgramElement getSuperElement()
Specified by:
getSuperElement in interface XProgramElement

getSuperInterfaceElements

public java.util.List getSuperInterfaceElements()
Specified by:
getSuperInterfaceElements in interface XProgramElement
Overrides:
getSuperInterfaceElements in class MemberImpl

getAccessor

public XMethod getAccessor()
Description copied from interface: XMethod
If this method is a mutator, and a corresponding accessor exists, that accessor will be returned. Otherwise, null is returned.

Specified by:
getAccessor in interface XMethod
Returns:
the corresponding accessor.

getMutator

public XMethod getMutator()
Description copied from interface: XMethod
If this method is an accessor, and a corresponding mutator exists, that mutator will be returned. Otherwise, null is returned.

Specified by:
getMutator in interface XMethod
Returns:
the corresponding mutator.

isPropertyAccessor

public boolean isPropertyAccessor()
Specified by:
isPropertyAccessor in interface XMethod
Returns:
true if this is a public Xxx getXxx() method

isPropertyMutator

public boolean isPropertyMutator()
Specified by:
isPropertyMutator in interface XMethod
Returns:
true if this is a public void setXxx(Xxx) method

getPropertyName

public java.lang.String getPropertyName()
Description copied from interface: XMethod
Returns the property name of this method (if it is an accessor or mutator), or null if it is not.

Specified by:
getPropertyName in interface XMethod
Returns:
the property name.

getPropertyType

public Type getPropertyType()
Description copied from interface: XMethod
Returns the type of the property this method represents, or null if this method is not a property method.

Specified by:
getPropertyType in interface XMethod
Returns:
the property type
See Also:
XMethod.isPropertyMutator(), XMethod.isPropertyAccessor(), XMethod.getPropertyName()

getNameWithoutPrefix

public java.lang.String getNameWithoutPrefix()
Description copied from interface: XMethod
Returns the name of the method with the prefix stripped away. The prefix is the first series of lower case characters. Example:

Specified by:
getNameWithoutPrefix in interface XMethod
Returns:
the property name.

setReturnType

public final void setReturnType(java.lang.String returnType)
Sets the ReturnType attribute of the SourceMethod object

Parameters:
returnType - The new ReturnType value

setReturnDimension

public final void setReturnDimension(int d)
Sets the ReturnDimension attribute of the SourceMethod object

Parameters:
d - The new ReturnDimension value

equals

public boolean equals(java.lang.Object o)
Two methods are equal if they have the same return type, name and signature, regardless of the enclosing class and modifiers. Methods are compared for equality when calling XClass.getMethods(true)

Overrides:
equals in class AbstractExecutableMember
Parameters:
o -
Returns:

hashCode

public int hashCode()
Overrides:
hashCode in class AbstractExecutableMember

toString

public java.lang.String toString()
Overrides:
toString in class AbstractExecutableMember

buildStringId

protected java.lang.String buildStringId()
Specified by:
buildStringId in class AbstractExecutableMember

getMethodNameWithSignatureAndModifiers

private java.lang.String getMethodNameWithSignatureAndModifiers()

getMethodNameWithSignatureWithoutModifiers

private java.lang.String getMethodNameWithSignatureWithoutModifiers()

toString

private java.lang.String toString(boolean modifiers)
Builds a String uniquely describing this method

Parameters:
modifiers -
Returns:
a String uniquely describing this method

isNative

public final boolean isNative()
Gets the Native attribute of the AbstractExecutableMember object

Specified by:
isNative in interface XExecutableMember
Returns:
The Native value

isSynchronized

public final boolean isSynchronized()
Gets the Synchronized attribute of the AbstractExecutableMember object

Specified by:
isSynchronized in interface XExecutableMember
Returns:
The Synchronized value

getParameters

public final java.util.List getParameters()
Returns the method parameters.

Specified by:
getParameters in interface XExecutableMember
Returns:
the method parameters

getSignature

public final java.lang.String getSignature(boolean withParam)
Gets the signature

Specified by:
getSignature in interface XExecutableMember
Parameters:
withParam - if true, include the parameters in the signature. Otherwise, only the types will be used.
Returns:
the signature

getNameWithSignature

public final java.lang.String getNameWithSignature(boolean withParam)
Gets the name and signature

Specified by:
getNameWithSignature in interface XExecutableMember
Parameters:
withParam - if true, include the parameters in the signature. Otherwise, only the types will be used.
Returns:
the name and signature

getParameterTypes

public java.lang.String getParameterTypes()
Description copied from interface: XExecutableMember
Returns the parameters as a comma separated list of classes. E.g. a method with signature (java.lang.String,int) would return java.lang.String.class, java.lang.Integer.TYPE.

Specified by:
getParameterTypes in interface XExecutableMember
Returns:
comma separated list of types for all parameters.

getThrownExceptions

public java.util.List getThrownExceptions()
Description copied from interface: XExecutableMember
Returns the thrown exception classes.

Specified by:
getThrownExceptions in interface XExecutableMember
Returns:
a Collection of XClass.

getSuperElement

public XProgramElement getSuperElement(boolean forMethod)

throwsException

public boolean throwsException(java.lang.String exception_class_name)
Description copied from interface: XExecutableMember
Return true if the member throws the specified exception in its throws block.

Specified by:
throwsException in interface XExecutableMember
Parameters:
exception_class_name -
Returns:
true if the member throws the exception

addParameterData

public void addParameterData(java.lang.String type,
                             java.lang.String name,
                             int dimension)
Adds a parameter

Parameters:
type - qualified nyme of parameter type
name - parameter name
dimension - parameter dimension

addThrownException

public void addThrownException(java.lang.String thrownException)

getParameterType

final java.lang.String getParameterType(int index)

getParameterName

final java.lang.String getParameterName(int index)

getParameterDimension

final int getParameterDimension(int index)

getName

public java.lang.String getName()
Description copied from interface: Named
Get name

Specified by:
getName in interface Named
Returns:
name

setName

public void setName(java.lang.String name)