Package com.thoughtworks.qdox.model
Class JavaMethodDelegate
- java.lang.Object
-
- com.thoughtworks.qdox.model.AbstractBaseJavaEntity
-
- com.thoughtworks.qdox.model.AbstractJavaEntity
-
- com.thoughtworks.qdox.model.AbstractInheritableJavaEntity
-
- com.thoughtworks.qdox.model.JavaMethod
-
- com.thoughtworks.qdox.model.JavaMethodDelegate
-
- All Implemented Interfaces:
Member
,java.io.Serializable
,java.lang.Comparable
public class JavaMethodDelegate extends JavaMethod
This class can be used to access overridden methods while keeping a reference to the original class. This is especially useful when trying to resolve generics- Since:
- 1.12
- Author:
- Robert Scholte
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.thoughtworks.qdox.model.AbstractJavaEntity
modifiers
-
Fields inherited from class com.thoughtworks.qdox.model.AbstractBaseJavaEntity
name, parent
-
-
Constructor Summary
Constructors Constructor Description JavaMethodDelegate(JavaClass callingClass, JavaMethod originalMethod)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addParameter(JavaParameter javaParameter)
int
compareTo(java.lang.Object o)
boolean
equals(java.lang.Object obj)
Annotation[]
getAnnotations()
java.lang.String
getCallSignature()
java.lang.String
getCodeBlock()
java.lang.String
getComment()
java.lang.String
getDeclarationSignature(boolean withModifiers)
Type[]
getExceptions()
Type
getGenericReturnType()
Equivalent of java.lang.reflect.Method.getGenericReturnType()int
getLineNumber()
java.lang.String[]
getModifiers()
Return list of modifiers as Strings.java.lang.String
getName()
java.lang.String
getNamedParameter(java.lang.String tagName, java.lang.String parameterName)
Convenience method forgetTagByName(String).getNamedParameter(String)
that also checks for null tag.JavaParameter
getParameterByName(java.lang.String name)
JavaParameter[]
getParameters()
Type[]
getParameterTypes()
Type[]
getParameterTypes(boolean resolve)
If a class inherits this method from a generic class or interface, you can use this method to get the resolved parameter typesprotected Type[]
getParameterTypes(boolean resolve, JavaClass _callingClass)
JavaClassParent
getParent()
JavaClass
getParentClass()
Not every entity has a parentClass, but AnnotationFieldRef requires access to it.java.lang.String
getPropertyName()
Type
getPropertyType()
Type
getReturns()
Type
getReturnType()
Equivalent of java.lang.reflect.Method.getReturnType()Type
getReturnType(boolean resolve)
If a class inherits this method from a generic class or interface, you can use this method to get the resolved return typeprotected Type
getReturnType(boolean resolve, JavaClass _callingClass)
JavaSource
getSource()
java.lang.String
getSourceCode()
Get the original source code of the body of this method.DocletTag
getTagByName(java.lang.String name)
DocletTag
getTagByName(java.lang.String name, boolean inherited)
DocletTag[]
getTags()
DocletTag[]
getTagsByName(java.lang.String name)
DocletTag[]
getTagsByName(java.lang.String name, boolean inherited)
TypeVariable[]
getTypeParameters()
int
hashCode()
boolean
isAbstract()
boolean
isConstructor()
boolean
isFinal()
boolean
isNative()
boolean
isPrivate()
boolean
isPropertyAccessor()
boolean
isPropertyMutator()
boolean
isProtected()
boolean
isPublic()
boolean
isStatic()
boolean
isStrictfp()
boolean
isSynchronized()
boolean
isTransient()
boolean
isVarArgs()
boolean
isVolatile()
void
setAnnotations(Annotation[] annotations)
void
setComment(java.lang.String comment)
void
setConstructor(boolean constructor)
void
setExceptions(Type[] exceptions)
void
setLineNumber(int lineNumber)
void
setModifiers(java.lang.String[] modifiers)
void
setName(java.lang.String name)
void
setParent(JavaClassParent parent)
void
setParentClass(JavaClass parentClass)
void
setReturns(Type returns)
Define the return type of this methodvoid
setSourceCode(java.lang.String sourceCode)
void
setTags(java.util.List tagList)
void
setTypeParameters(TypeVariable[] typeParameters)
boolean
signatureMatches(java.lang.String name, Type[] parameterTypes)
This method is NOT varArg aware.boolean
signatureMatches(java.lang.String name, Type[] parameterTypes, boolean varArg)
java.lang.String
toString()
-
Methods inherited from class com.thoughtworks.qdox.model.JavaMethod
writeBody, writeBody
-
Methods inherited from class com.thoughtworks.qdox.model.AbstractJavaEntity
write, writeAccessibilityModifier, writeAllModifiers, writeNonAccessibilityModifiers
-
-
-
-
Constructor Detail
-
JavaMethodDelegate
public JavaMethodDelegate(JavaClass callingClass, JavaMethod originalMethod)
-
-
Method Detail
-
getReturnType
public Type getReturnType(boolean resolve)
Description copied from class:JavaMethod
If a class inherits this method from a generic class or interface, you can use this method to get the resolved return type- Overrides:
getReturnType
in classJavaMethod
- Returns:
-
getReturnType
protected Type getReturnType(boolean resolve, JavaClass _callingClass)
- Overrides:
getReturnType
in classJavaMethod
- Returns:
-
getParameterTypes
public Type[] getParameterTypes(boolean resolve)
Description copied from class:JavaMethod
If a class inherits this method from a generic class or interface, you can use this method to get the resolved parameter types- Overrides:
getParameterTypes
in classJavaMethod
- Returns:
- the parameter types as array
-
getParameterTypes
protected Type[] getParameterTypes(boolean resolve, JavaClass _callingClass)
- Overrides:
getParameterTypes
in classJavaMethod
-
addParameter
public void addParameter(JavaParameter javaParameter)
- Overrides:
addParameter
in classJavaMethod
-
compareTo
public int compareTo(java.lang.Object o)
- Specified by:
compareTo
in interfacejava.lang.Comparable
- Overrides:
compareTo
in classJavaMethod
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classJavaMethod
-
getAnnotations
public Annotation[] getAnnotations()
- Overrides:
getAnnotations
in classAbstractBaseJavaEntity
-
getCallSignature
public java.lang.String getCallSignature()
- Specified by:
getCallSignature
in interfaceMember
- Overrides:
getCallSignature
in classJavaMethod
-
getCodeBlock
public java.lang.String getCodeBlock()
- Overrides:
getCodeBlock
in classAbstractJavaEntity
-
getComment
public java.lang.String getComment()
- Overrides:
getComment
in classAbstractJavaEntity
-
getDeclarationSignature
public java.lang.String getDeclarationSignature(boolean withModifiers)
- Specified by:
getDeclarationSignature
in interfaceMember
- Overrides:
getDeclarationSignature
in classJavaMethod
-
getExceptions
public Type[] getExceptions()
- Overrides:
getExceptions
in classJavaMethod
-
getGenericReturnType
public Type getGenericReturnType()
Description copied from class:JavaMethod
Equivalent of java.lang.reflect.Method.getGenericReturnType()- Overrides:
getGenericReturnType
in classJavaMethod
- Returns:
- the generic returntype
-
getLineNumber
public int getLineNumber()
- Overrides:
getLineNumber
in classAbstractBaseJavaEntity
-
getModifiers
public java.lang.String[] getModifiers()
Description copied from class:AbstractJavaEntity
Return list of modifiers as Strings. (public, private, protected, final, abstract, static)- Overrides:
getModifiers
in classAbstractJavaEntity
-
getName
public java.lang.String getName()
- Overrides:
getName
in classAbstractBaseJavaEntity
-
getNamedParameter
public java.lang.String getNamedParameter(java.lang.String tagName, java.lang.String parameterName)
Description copied from class:AbstractJavaEntity
Convenience method forgetTagByName(String).getNamedParameter(String)
that also checks for null tag.- Overrides:
getNamedParameter
in classAbstractJavaEntity
-
getParameterByName
public JavaParameter getParameterByName(java.lang.String name)
- Overrides:
getParameterByName
in classJavaMethod
-
getParameters
public JavaParameter[] getParameters()
- Overrides:
getParameters
in classJavaMethod
-
getParameterTypes
public Type[] getParameterTypes()
- Overrides:
getParameterTypes
in classJavaMethod
- Returns:
- the parameter types as array
-
getParent
public JavaClassParent getParent()
- Overrides:
getParent
in classAbstractBaseJavaEntity
- Returns:
-
getParentClass
public JavaClass getParentClass()
Description copied from class:AbstractBaseJavaEntity
Not every entity has a parentClass, but AnnotationFieldRef requires access to it. When used with JavaClass, don't confuse this with getSuperClass()- Overrides:
getParentClass
in classAbstractJavaEntity
- Returns:
- the surrounding class
-
getPropertyName
public java.lang.String getPropertyName()
- Overrides:
getPropertyName
in classJavaMethod
- Returns:
- the name of the property this method represents, or null if this method is not a property mutator or property accessor.
-
getPropertyType
public Type getPropertyType()
- Overrides:
getPropertyType
in classJavaMethod
- Returns:
- the type of the property this method represents, or null if this method is not a property mutator or property accessor.
-
getReturns
public Type getReturns()
- Overrides:
getReturns
in classJavaMethod
- Returns:
- the return type
-
getReturnType
public Type getReturnType()
Description copied from class:JavaMethod
Equivalent of java.lang.reflect.Method.getReturnType()- Overrides:
getReturnType
in classJavaMethod
- Returns:
-
getSource
public JavaSource getSource()
- Overrides:
getSource
in classAbstractJavaEntity
-
getSourceCode
public java.lang.String getSourceCode()
Description copied from class:JavaMethod
Get the original source code of the body of this method.- Overrides:
getSourceCode
in classJavaMethod
- Returns:
- Code as string.
-
getTagByName
public DocletTag getTagByName(java.lang.String name, boolean inherited)
- Overrides:
getTagByName
in classAbstractInheritableJavaEntity
-
getTagByName
public DocletTag getTagByName(java.lang.String name)
- Overrides:
getTagByName
in classAbstractJavaEntity
-
getTags
public DocletTag[] getTags()
- Overrides:
getTags
in classAbstractJavaEntity
-
getTagsByName
public DocletTag[] getTagsByName(java.lang.String name, boolean inherited)
- Overrides:
getTagsByName
in classJavaMethod
-
getTagsByName
public DocletTag[] getTagsByName(java.lang.String name)
- Overrides:
getTagsByName
in classAbstractJavaEntity
-
getTypeParameters
public TypeVariable[] getTypeParameters()
- Overrides:
getTypeParameters
in classJavaMethod
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classJavaMethod
-
isAbstract
public boolean isAbstract()
- Overrides:
isAbstract
in classAbstractJavaEntity
-
isConstructor
public boolean isConstructor()
- Overrides:
isConstructor
in classJavaMethod
- Returns:
- true is this method is a constructor
-
isFinal
public boolean isFinal()
- Overrides:
isFinal
in classAbstractJavaEntity
-
isNative
public boolean isNative()
- Overrides:
isNative
in classAbstractJavaEntity
-
isPrivate
public boolean isPrivate()
- Overrides:
isPrivate
in classAbstractJavaEntity
-
isPropertyAccessor
public boolean isPropertyAccessor()
- Overrides:
isPropertyAccessor
in classJavaMethod
- Returns:
- true if this method is a Java Bean accessor
-
isPropertyMutator
public boolean isPropertyMutator()
- Overrides:
isPropertyMutator
in classJavaMethod
- Returns:
- true if this method is a Java Bean accessor
-
isProtected
public boolean isProtected()
- Overrides:
isProtected
in classAbstractJavaEntity
-
isPublic
public boolean isPublic()
- Overrides:
isPublic
in classJavaMethod
-
isStatic
public boolean isStatic()
- Overrides:
isStatic
in classAbstractJavaEntity
-
isStrictfp
public boolean isStrictfp()
- Overrides:
isStrictfp
in classAbstractJavaEntity
-
isSynchronized
public boolean isSynchronized()
- Overrides:
isSynchronized
in classAbstractJavaEntity
-
isTransient
public boolean isTransient()
- Overrides:
isTransient
in classAbstractJavaEntity
-
isVarArgs
public boolean isVarArgs()
- Overrides:
isVarArgs
in classJavaMethod
- Returns:
- true is this method conains varArgs
-
isVolatile
public boolean isVolatile()
- Overrides:
isVolatile
in classAbstractJavaEntity
-
setAnnotations
public void setAnnotations(Annotation[] annotations)
- Overrides:
setAnnotations
in classAbstractBaseJavaEntity
-
setComment
public void setComment(java.lang.String comment)
- Overrides:
setComment
in classAbstractJavaEntity
-
setConstructor
public void setConstructor(boolean constructor)
- Overrides:
setConstructor
in classJavaMethod
-
setExceptions
public void setExceptions(Type[] exceptions)
- Overrides:
setExceptions
in classJavaMethod
-
setLineNumber
public void setLineNumber(int lineNumber)
- Overrides:
setLineNumber
in classAbstractBaseJavaEntity
-
setModifiers
public void setModifiers(java.lang.String[] modifiers)
- Overrides:
setModifiers
in classAbstractJavaEntity
-
setName
public void setName(java.lang.String name)
- Overrides:
setName
in classAbstractBaseJavaEntity
-
setParent
public void setParent(JavaClassParent parent)
- Overrides:
setParent
in classAbstractBaseJavaEntity
-
setParentClass
public void setParentClass(JavaClass parentClass)
- Overrides:
setParentClass
in classAbstractJavaEntity
-
setReturns
public void setReturns(Type returns)
Description copied from class:JavaMethod
Define the return type of this method- Overrides:
setReturns
in classJavaMethod
- Parameters:
returns
- the return type
-
setSourceCode
public void setSourceCode(java.lang.String sourceCode)
- Overrides:
setSourceCode
in classJavaMethod
-
setTags
public void setTags(java.util.List tagList)
- Overrides:
setTags
in classAbstractJavaEntity
-
setTypeParameters
public void setTypeParameters(TypeVariable[] typeParameters)
- Overrides:
setTypeParameters
in classJavaMethod
-
signatureMatches
public boolean signatureMatches(java.lang.String name, Type[] parameterTypes, boolean varArg)
- Overrides:
signatureMatches
in classJavaMethod
- Parameters:
name
- method nameparameterTypes
- parameter types or null if there are no parameters.- Returns:
- true if the signature and parameters match.
-
signatureMatches
public boolean signatureMatches(java.lang.String name, Type[] parameterTypes)
Description copied from class:JavaMethod
This method is NOT varArg aware. The overloaded method is.- Overrides:
signatureMatches
in classJavaMethod
- Returns:
-
toString
public java.lang.String toString()
- Overrides:
toString
in classJavaMethod
-
-