Class JavaMethodDelegate

    • Constructor Detail

      • JavaMethodDelegate

        public JavaMethodDelegate​(JavaClass callingClass,
                                  JavaMethod originalMethod)
    • Method Detail

      • getReturnType

        public JavaType getReturnType​(boolean resolve)
        Description copied from interface: JavaMethod
        If a class inherits this method from a generic class or interface, you can use this method to get the resolved return type
        Specified by:
        getReturnType in interface JavaMethod
        Parameters:
        resolve - define if generic should be resolved
        Returns:
        the return type
      • getParameterTypes

        public List<JavaType> 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
        Specified by:
        getParameterTypes in interface JavaExecutable
        Parameters:
        resolve - true if the resolved types should be returned, otherwise false
        Returns:
        the parameter types
      • getComment

        public String getComment()
        Retrieve the javadoc comment of this annotated element. This is the part between /** and the */, but without the doclet tags
        Specified by:
        getComment in interface JavaAnnotatedElement
        Returns:
        the comment, otherwise null
      • getDeclarationSignature

        public String getDeclarationSignature​(boolean withModifiers)
        Specified by:
        getDeclarationSignature in interface JavaMethod
        Parameters:
        withModifiers - true if modifiers should be added, otherwise false
        Returns:
        the declaration signature
      • isDefault

        public boolean isDefault()
        Specified by:
        isDefault in interface JavaMethod
        Returns:
        true if this is a default method of an interface, otherwise false
      • getLineNumber

        public int getLineNumber()
        The line number where this element started
        Specified by:
        getLineNumber in interface JavaModel
        Returns:
        the line number of this element
      • getModifiers

        public List<String> getModifiers()
        Equivalent of Member.getModifiers() This does not follow the java-api With the Member-class, getModifiers returns an int, which should be decoded with the Modifier. If this member was extracted from a source, it will keep its order. Otherwise if will be in the preferred order of the java-api.
        Specified by:
        getModifiers in interface JavaMember
        Returns:
        all modifiers is this member
      • getNamedParameter

        public String getNamedParameter​(String tagName,
                                        String parameterName)
        Convenience method for getTagByName(String).getNamedParameter(String) that also checks for null tag.
        Specified by:
        getNamedParameter in interface JavaAnnotatedElement
        Parameters:
        tagName - the tag name
        parameterName - the parameter name
        Returns:
        the value of the matching parameter, otherwise null
      • getPropertyName

        public String getPropertyName()
        Specified by:
        getPropertyName in interface 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 JavaType getPropertyType()
        Specified by:
        getPropertyType in interface JavaMethod
        Returns:
        the type of the property this method represents, or null if this method is not a property mutator or property accessor.
      • getSourceCode

        public String getSourceCode()
        Get the original source code of the body of this method.
        Specified by:
        getSourceCode in interface JavaExecutable
        Returns:
        Code as string.
      • getTagByName

        public DocletTag getTagByName​(String name)
        Retrieve the doclettag by the specified name. If there are more than one tags, only return the first one.
        Specified by:
        getTagByName in interface JavaAnnotatedElement
        Parameters:
        name - the name of the doclettag trying to retrieve
        Returns:
        the first doclettag matching the name, otherwise null
      • getTagsByName

        public List<DocletTag> getTagsByName​(String name)
        Retrieve all doclettags with a specific name.
        Specified by:
        getTagsByName in interface JavaAnnotatedElement
        Parameters:
        name - the name of the doclet tag
        Returns:
        a list of doclettags, never null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isPropertyAccessor

        public boolean isPropertyAccessor()
        Returns true if this method follows the bean convention of being an accessor.
           public String getName();             // true
           public boolean isValid()             // true
           public String getName( String def ); // false, it has a parameter
           public String gettingUp();           // false, 'get' is not followed by an uppercase character
           public boolean isolate();            // false, 'is' is not followed by an uppercase character
           public static String getName();      // false, it is static
         
        Specified by:
        isPropertyAccessor in interface JavaMethod
        Returns:
        true if this method is a Java Bean accessor, otherwise false
      • isPropertyMutator

        public boolean isPropertyMutator()
        Returns true if this method follows the bean convention of being an mutator.
          public void setName(String name);        // true
          public void setUp();                     // false, it has no parameter
          public void settingUp(String def);       // false, 'set' is not followed by an uppercase character
          public static void setName(String name); // false, it is static
         
        Specified by:
        isPropertyMutator in interface JavaMethod
        Returns:
        true if this method is a Java Bean mutator, otherwise false
      • signatureMatches

        public boolean signatureMatches​(String name,
                                        List<JavaType> parameterTypes,
                                        boolean varArg)
        Specified by:
        signatureMatches in interface JavaMethod
        Parameters:
        name - the name of the method
        parameterTypes - the parameter types, can be null
        varArg - true is signature should match a varArg-method, otherwise false
        Returns:
        true if this method matches the signature, otherwise false
      • signatureMatches

        public boolean signatureMatches​(String name,
                                        List<JavaType> parameterTypes)
        This method is NOT varArg aware.
        Specified by:
        signatureMatches in interface JavaMethod
        Parameters:
        name - the name of the method
        parameterTypes - the parameter types of the method, can be null
        Returns:
        true if this method matches the signature, otherwise false
      • getReturnType

        public JavaType getReturnType()
        Equivalent of java.lang.reflect.Method.getReturnType()
        Specified by:
        getReturnType in interface JavaMethod
        Returns:
        the return type