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
,Serializable
,Comparable
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:
-
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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addParameter
(JavaParameter javaParameter) int
boolean
getDeclarationSignature
(boolean withModifiers) Type[]
Equivalent of java.lang.reflect.Method.getGenericReturnType()int
String[]
Return list of modifiers as Strings.getName()
getNamedParameter
(String tagName, String parameterName) Convenience method forgetTagByName(String).getNamedParameter(String)
that also checks for null tag.getParameterByName
(String name) Type[]
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) Not every entity has a parentClass, but AnnotationFieldRef requires access to it.Equivalent of java.lang.reflect.Method.getReturnType()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) Get the original source code of the body of this method.getTagByName
(String name) getTagByName
(String name, boolean inherited) getTags()
getTagsByName
(String name) getTagsByName
(String name, boolean inherited) int
hashCode()
boolean
boolean
boolean
isFinal()
boolean
isNative()
boolean
boolean
boolean
boolean
boolean
isPublic()
boolean
isStatic()
boolean
boolean
boolean
boolean
boolean
void
setAnnotations
(Annotation[] annotations) void
setComment
(String comment) void
setConstructor
(boolean constructor) void
setExceptions
(Type[] exceptions) void
setLineNumber
(int lineNumber) void
setModifiers
(String[] modifiers) void
void
setParent
(JavaClassParent parent) void
setParentClass
(JavaClass parentClass) void
setReturns
(Type returns) Define the return type of this methodvoid
setSourceCode
(String sourceCode) void
void
setTypeParameters
(TypeVariable[] typeParameters) boolean
signatureMatches
(String name, Type[] parameterTypes) This method is NOT varArg aware.boolean
signatureMatches
(String name, Type[] parameterTypes, boolean varArg) 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 Details
-
JavaMethodDelegate
-
-
Method Details
-
getReturnType
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
- Overrides:
getReturnType
in classJavaMethod
- Returns:
-
getParameterTypes
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
- Overrides:
getParameterTypes
in classJavaMethod
-
addParameter
- Overrides:
addParameter
in classJavaMethod
-
compareTo
- Specified by:
compareTo
in interfaceComparable
- Overrides:
compareTo
in classJavaMethod
-
equals
- Overrides:
equals
in classJavaMethod
-
getAnnotations
- Overrides:
getAnnotations
in classAbstractBaseJavaEntity
-
getCallSignature
- Specified by:
getCallSignature
in interfaceMember
- Overrides:
getCallSignature
in classJavaMethod
-
getCodeBlock
- Overrides:
getCodeBlock
in classAbstractJavaEntity
-
getComment
- Overrides:
getComment
in classAbstractJavaEntity
-
getDeclarationSignature
- Specified by:
getDeclarationSignature
in interfaceMember
- Overrides:
getDeclarationSignature
in classJavaMethod
-
getExceptions
- Overrides:
getExceptions
in classJavaMethod
-
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
Description copied from class:AbstractJavaEntity
Return list of modifiers as Strings. (public, private, protected, final, abstract, static)- Overrides:
getModifiers
in classAbstractJavaEntity
-
getName
- Overrides:
getName
in classAbstractBaseJavaEntity
-
getNamedParameter
Description copied from class:AbstractJavaEntity
Convenience method forgetTagByName(String).getNamedParameter(String)
that also checks for null tag.- Overrides:
getNamedParameter
in classAbstractJavaEntity
-
getParameterByName
- Overrides:
getParameterByName
in classJavaMethod
-
getParameters
- Overrides:
getParameters
in classJavaMethod
-
getParameterTypes
- Overrides:
getParameterTypes
in classJavaMethod
- Returns:
- the parameter types as array
-
getParent
- Overrides:
getParent
in classAbstractBaseJavaEntity
- Returns:
-
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
- 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
- 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
- Overrides:
getReturns
in classJavaMethod
- Returns:
- the return type
-
getReturnType
Description copied from class:JavaMethod
Equivalent of java.lang.reflect.Method.getReturnType()- Overrides:
getReturnType
in classJavaMethod
- Returns:
-
getSource
- Overrides:
getSource
in classAbstractJavaEntity
-
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
- Overrides:
getTagByName
in classAbstractInheritableJavaEntity
-
getTagByName
- Overrides:
getTagByName
in classAbstractJavaEntity
-
getTags
- Overrides:
getTags
in classAbstractJavaEntity
-
getTagsByName
- Overrides:
getTagsByName
in classJavaMethod
-
getTagsByName
- Overrides:
getTagsByName
in classAbstractJavaEntity
-
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
- Overrides:
setAnnotations
in classAbstractBaseJavaEntity
-
setComment
- Overrides:
setComment
in classAbstractJavaEntity
-
setConstructor
public void setConstructor(boolean constructor) - Overrides:
setConstructor
in classJavaMethod
-
setExceptions
- Overrides:
setExceptions
in classJavaMethod
-
setLineNumber
public void setLineNumber(int lineNumber) - Overrides:
setLineNumber
in classAbstractBaseJavaEntity
-
setModifiers
- Overrides:
setModifiers
in classAbstractJavaEntity
-
setName
- Overrides:
setName
in classAbstractBaseJavaEntity
-
setParent
- Overrides:
setParent
in classAbstractBaseJavaEntity
-
setParentClass
- Overrides:
setParentClass
in classAbstractJavaEntity
-
setReturns
Description copied from class:JavaMethod
Define the return type of this method- Overrides:
setReturns
in classJavaMethod
- Parameters:
returns
- the return type
-
setSourceCode
- Overrides:
setSourceCode
in classJavaMethod
-
setTags
- Overrides:
setTags
in classAbstractJavaEntity
-
setTypeParameters
- Overrides:
setTypeParameters
in classJavaMethod
-
signatureMatches
- 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
Description copied from class:JavaMethod
This method is NOT varArg aware. The overloaded method is.- Overrides:
signatureMatches
in classJavaMethod
- Returns:
-
toString
- Overrides:
toString
in classJavaMethod
-