xjavadoc

Class MethodImpl

Implemented Interfaces:
Comparable, Named, XExecutableMember, XMember, XMethod, XProgramElement

(package private) final class MethodImpl
extends AbstractExecutableMember
implements XMethod

Describe what this class does

Author:
Aslak Helles?y

Nested Class Summary

Field Summary

private ReturnType
_returnType
static int
instanceCount
private String
methodNameWithSignatureAndModifiers
private String
methodNameWithSignatureWithoutModifiers

Fields inherited from class xjavadoc.AbstractExecutableMember

INITIAL_PARAMETER_POOL_SIZE, MAX_ARRAY_SIZE, PARAMETER_DATA_SIZE, _dimensions, _nameWithSignature, _parameterData, _parameterPool, _signature, _stringId, _thrownExceptions

Fields inherited from class xjavadoc.MemberImpl

_name

Fields inherited from class xjavadoc.AbstractProgramElement

EMPTY_LIST, _containingClass, _doc, _javadocToken, _modifierString, _modifiers, _tagFactory, _token, _xJavaDoc

Fields inherited from interface xjavadoc.XMethod

PROPERTY_ACCESSOR_PREDICATE, PROPERTY_MUTATOR_PREDICATE

Constructor Summary

MethodImpl(AbstractClass containingClass, XTagFactory tagFactory)

Method Summary

protected String
buildStringId()
boolean
equals(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 String
getMethodNameWithSignatureAndModifiers()
private String
getMethodNameWithSignatureWithoutModifiers()
XMethod
getMutator()
If this method is an accessor, and a corresponding mutator exists, that mutator will be returned.
String
getNameWithoutPrefix()
Returns the name of the method with the prefix stripped away.
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.
XProgramElement
getSuperElement()
List
getSuperInterfaceElements()
int
hashCode()
boolean
isConstructor()
Gets the Constructor attribute of the SourceMethod object
boolean
isPropertyAccessor()
boolean
isPropertyMutator()
void
setReturnDimension(int d)
Sets the ReturnDimension attribute of the SourceMethod object
void
setReturnType(String returnType)
Sets the ReturnType attribute of the SourceMethod object
String
toString()
private String
toString(boolean modifiers)
Builds a String uniquely describing this method

Methods inherited from class xjavadoc.AbstractExecutableMember

addParameterData, addThrownException, appendSignature, buildStringId, equals, getNameWithSignature, getParameterDimension, getParameterName, getParameterType, getParameterTypes, getParameters, getQualifiedExceptions, getSignature, getSuperElement, getThrownExceptions, hashCode, isNative, isSynchronized, stringId, throwsException, toString, toString

Methods inherited from class xjavadoc.MemberImpl

getName, getSuperInterfaceElements, setName

Methods inherited from class xjavadoc.AbstractProgramElement

addModifier, compareTo, getContainingAbstractClass, getContainingClass, getContainingPackage, getDoc, getModifierSpecifier, getModifiers, getTagFactory, getXJavaDoc, isAbstract, isFinal, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, reset, setJavaDoc, setToken, updateDoc

Field Details

_returnType

private ReturnType _returnType


instanceCount

public static int instanceCount


methodNameWithSignatureAndModifiers

private String methodNameWithSignatureAndModifiers


methodNameWithSignatureWithoutModifiers

private String methodNameWithSignatureWithoutModifiers

Constructor Details

MethodImpl

public MethodImpl(AbstractClass containingClass,
                  XTagFactory tagFactory)

Method Details

buildStringId

protected String buildStringId()
Overrides:
buildStringId in interface AbstractExecutableMember


equals

public boolean equals(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 interface AbstractExecutableMember

Parameters:
o -

Returns:


getAccessor

public XMethod getAccessor()
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.


getMethodNameWithSignatureAndModifiers

private String getMethodNameWithSignatureAndModifiers()


getMethodNameWithSignatureWithoutModifiers

private String getMethodNameWithSignatureWithoutModifiers()


getMutator

public XMethod getMutator()
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.


getNameWithoutPrefix

public String getNameWithoutPrefix()
Returns the name of the method with the prefix stripped away. The prefix is the first series of lower case characters. Example:
  • "isIt" -> "It"
  • "setIt" -> "It"
  • "addIt" -> "It"
  • "createIt" -> "It"
  • "isit" -> null
Specified by:
getNameWithoutPrefix in interface XMethod

Returns:
the property name.


getPropertyName

public String getPropertyName()
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()
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()


getReturnType

public final Type getReturnType()
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 List getSuperInterfaceElements()
Specified by:
getSuperInterfaceElements in interface XProgramElement
Overrides:
getSuperInterfaceElements in interface MemberImpl


hashCode

public int hashCode()
Overrides:
hashCode in interface AbstractExecutableMember


isConstructor

public final boolean isConstructor()
Gets the Constructor attribute of the SourceMethod object
Specified by:
isConstructor in interface XExecutableMember

Returns:
The Constructor value


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


setReturnDimension

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

Parameters:
d - The new ReturnDimension value


setReturnType

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

Parameters:
returnType - The new ReturnType value


toString

public String toString()
Overrides:
toString in interface AbstractExecutableMember


toString

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

Parameters:
modifiers -

Returns:
a String uniquely describing this method