JavaMethodDelegate
Date: 2017-03-29

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
  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 and Description
    `JavaMethodDelegate(JavaClass callingClass, JavaMethod originalMethod)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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 for `getTagByName(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 types
    `protected 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 type
    `protected 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 method
    `void` | `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`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### 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 class `JavaMethod`
      Returns:

    - #### getReturnType

          protected Type getReturnType(boolean resolve,
                           JavaClass _callingClass)

      Overrides:
        `getReturnType` in class `JavaMethod`
      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 class `JavaMethod`
      Returns:
        the parameter types as array

    - #### getParameterTypes

          protected Type[] getParameterTypes(boolean resolve,
                                 JavaClass _callingClass)

      Overrides:
        `getParameterTypes` in class `JavaMethod`

    - #### addParameter

          public void addParameter(JavaParameter javaParameter)

      Overrides:
        `addParameter` in class `JavaMethod`

    - #### compareTo

          public int compareTo(java.lang.Object o)

      Specified by:
        `compareTo` in interface `java.lang.Comparable`
      Overrides:
        `compareTo` in class `JavaMethod`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `JavaMethod`

    - #### getAnnotations

          public Annotation[] getAnnotations()

      Overrides:
        `getAnnotations` in class `AbstractBaseJavaEntity`

    - #### getCallSignature

          public java.lang.String getCallSignature()

      Specified by:
        `getCallSignature` in interface `Member`
      Overrides:
        `getCallSignature` in class `JavaMethod`

    - #### getCodeBlock

          public java.lang.String getCodeBlock()

      Overrides:
        `getCodeBlock` in class `AbstractJavaEntity`

    - #### getComment

          public java.lang.String getComment()

      Overrides:
        `getComment` in class `AbstractJavaEntity`

    - #### getDeclarationSignature

          public java.lang.String getDeclarationSignature(boolean withModifiers)

      Specified by:
        `getDeclarationSignature` in interface `Member`
      Overrides:
        `getDeclarationSignature` in class `JavaMethod`

    - #### getExceptions

          public Type[] getExceptions()

      Overrides:
        `getExceptions` in class `JavaMethod`

    - #### getGenericReturnType

          public Type getGenericReturnType()

      Description copied from class: `JavaMethod`
      Equivalent of java.lang.reflect.Method.getGenericReturnType()
      Overrides:
        `getGenericReturnType` in class `JavaMethod`
      Returns:
        the generic returntype

    - #### getLineNumber

          public int getLineNumber()

      Overrides:
        `getLineNumber` in class `AbstractBaseJavaEntity`

    - #### 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 class `AbstractJavaEntity`

    - #### getName

          public java.lang.String getName()

      Overrides:
        `getName` in class `AbstractBaseJavaEntity`

    - #### getNamedParameter

          public java.lang.String getNamedParameter(java.lang.String tagName,
                                           java.lang.String parameterName)

      Description copied from class: `AbstractJavaEntity`
      Convenience method for `getTagByName(String).getNamedParameter(String)` that also checks for null tag.
      Overrides:
        `getNamedParameter` in class `AbstractJavaEntity`

    - #### getParameterByName

          public JavaParameter getParameterByName(java.lang.String name)

      Overrides:
        `getParameterByName` in class `JavaMethod`

    - #### getParameters

          public JavaParameter[] getParameters()

      Overrides:
        `getParameters` in class `JavaMethod`

    - #### getParameterTypes

          public Type[] getParameterTypes()

      Overrides:
        `getParameterTypes` in class `JavaMethod`
      Returns:
        the parameter types as array

    - #### getParent

          public JavaClassParent getParent()

      Overrides:
        `getParent` in class `AbstractBaseJavaEntity`
      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 class `AbstractJavaEntity`
      Returns:
        the surrounding class

    - #### getPropertyName

          public java.lang.String getPropertyName()

      Overrides:
        `getPropertyName` in class `JavaMethod`
      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 class `JavaMethod`
      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 class `JavaMethod`
      Returns:
        the return type

    - #### getReturnType

          public Type getReturnType()

      Description copied from class: `JavaMethod`
      Equivalent of java.lang.reflect.Method.getReturnType()
      Overrides:
        `getReturnType` in class `JavaMethod`
      Returns:

    - #### getSource

          public JavaSource getSource()

      Overrides:
        `getSource` in class `AbstractJavaEntity`

    - #### 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 class `JavaMethod`
      Returns:
        Code as string.

    - #### getTagByName

          public DocletTag getTagByName(java.lang.String name,
                               boolean inherited)

      Overrides:
        `getTagByName` in class `AbstractInheritableJavaEntity`

    - #### getTagByName

          public DocletTag getTagByName(java.lang.String name)

      Overrides:
        `getTagByName` in class `AbstractJavaEntity`

    - #### getTags

          public DocletTag[] getTags()

      Overrides:
        `getTags` in class `AbstractJavaEntity`

    - #### getTagsByName

          public DocletTag[] getTagsByName(java.lang.String name,
                                  boolean inherited)

      Overrides:
        `getTagsByName` in class `JavaMethod`

    - #### getTagsByName

          public DocletTag[] getTagsByName(java.lang.String name)

      Overrides:
        `getTagsByName` in class `AbstractJavaEntity`

    - #### getTypeParameters

          public TypeVariable[] getTypeParameters()

      Overrides:
        `getTypeParameters` in class `JavaMethod`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `JavaMethod`

    - #### isAbstract

          public boolean isAbstract()

      Overrides:
        `isAbstract` in class `AbstractJavaEntity`

    - #### isConstructor

          public boolean isConstructor()

      Overrides:
        `isConstructor` in class `JavaMethod`
      Returns:
        true is this method is a constructor

    - #### isFinal

          public boolean isFinal()

      Overrides:
        `isFinal` in class `AbstractJavaEntity`

    - #### isNative

          public boolean isNative()

      Overrides:
        `isNative` in class `AbstractJavaEntity`

    - #### isPrivate

          public boolean isPrivate()

      Overrides:
        `isPrivate` in class `AbstractJavaEntity`

    - #### isPropertyAccessor

          public boolean isPropertyAccessor()

      Overrides:
        `isPropertyAccessor` in class `JavaMethod`
      Returns:
        true if this method is a Java Bean accessor

    - #### isPropertyMutator

          public boolean isPropertyMutator()

      Overrides:
        `isPropertyMutator` in class `JavaMethod`
      Returns:
        true if this method is a Java Bean accessor

    - #### isProtected

          public boolean isProtected()

      Overrides:
        `isProtected` in class `AbstractJavaEntity`

    - #### isPublic

          public boolean isPublic()

      Overrides:
        `isPublic` in class `JavaMethod`

    - #### isStatic

          public boolean isStatic()

      Overrides:
        `isStatic` in class `AbstractJavaEntity`

    - #### isStrictfp

          public boolean isStrictfp()

      Overrides:
        `isStrictfp` in class `AbstractJavaEntity`

    - #### isSynchronized

          public boolean isSynchronized()

      Overrides:
        `isSynchronized` in class `AbstractJavaEntity`

    - #### isTransient

          public boolean isTransient()

      Overrides:
        `isTransient` in class `AbstractJavaEntity`

    - #### isVarArgs

          public boolean isVarArgs()

      Overrides:
        `isVarArgs` in class `JavaMethod`
      Returns:
        true is this method conains varArgs

    - #### isVolatile

          public boolean isVolatile()

      Overrides:
        `isVolatile` in class `AbstractJavaEntity`

    - #### setAnnotations

          public void setAnnotations(Annotation[] annotations)

      Overrides:
        `setAnnotations` in class `AbstractBaseJavaEntity`

    - #### setComment

          public void setComment(java.lang.String comment)

      Overrides:
        `setComment` in class `AbstractJavaEntity`

    - #### setConstructor

          public void setConstructor(boolean constructor)

      Overrides:
        `setConstructor` in class `JavaMethod`

    - #### setExceptions

          public void setExceptions(Type[] exceptions)

      Overrides:
        `setExceptions` in class `JavaMethod`

    - #### setLineNumber

          public void setLineNumber(int lineNumber)

      Overrides:
        `setLineNumber` in class `AbstractBaseJavaEntity`

    - #### setModifiers

          public void setModifiers(java.lang.String[] modifiers)

      Overrides:
        `setModifiers` in class `AbstractJavaEntity`

    - #### setName

          public void setName(java.lang.String name)

      Overrides:
        `setName` in class `AbstractBaseJavaEntity`

    - #### setParent

          public void setParent(JavaClassParent parent)

      Overrides:
        `setParent` in class `AbstractBaseJavaEntity`

    - #### setParentClass

          public void setParentClass(JavaClass parentClass)

      Overrides:
        `setParentClass` in class `AbstractJavaEntity`

    - #### setReturns

          public void setReturns(Type returns)

      Description copied from class: `JavaMethod`
      Define the return type of this method
      Overrides:
        `setReturns` in class `JavaMethod`
      Parameters:
        `returns` - the return type

    - #### setSourceCode

          public void setSourceCode(java.lang.String sourceCode)

      Overrides:
        `setSourceCode` in class `JavaMethod`

    - #### setTags

          public void setTags(java.util.List tagList)

      Overrides:
        `setTags` in class `AbstractJavaEntity`

    - #### setTypeParameters

          public void setTypeParameters(TypeVariable[] typeParameters)

      Overrides:
        `setTypeParameters` in class `JavaMethod`

    - #### signatureMatches

          public boolean signatureMatches(java.lang.String name,
                                 Type[] parameterTypes,
                                 boolean varArg)

      Overrides:
        `signatureMatches` in class `JavaMethod`
      Parameters:
        `name` - method name
        `parameterTypes` - 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 class `JavaMethod`
      Returns:

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `JavaMethod`