Class JavadocParanamer

  • All Implemented Interfaces:
    Paranamer

    public class JavadocParanamer
    extends java.lang.Object
    implements Paranamer
    Accesses Javadocs to extract parameter names. Supports:-
    • Javadoc in zip file
    • Javadoc in directory
    • Javadoc at remote URL
    • Constructor Detail

      • JavadocParanamer

        public JavadocParanamer​(java.io.File archiveOrDirectory)
                         throws java.io.IOException
        Parameters:
        archiveOrDirectory - either a zip archive or base directory of Javadocs.
        Throws:
        java.io.FileNotFoundException - if the parameter or package-list cannot be found.
        java.io.IOException
      • JavadocParanamer

        public JavadocParanamer​(java.net.URL url)
                         throws java.io.IOException
        Parameters:
        url - base URL of the JavaDocs
        Throws:
        java.io.FileNotFoundException - if the url does not have a /package-list
        java.io.IOException
    • Method Detail

      • lookupParameterNames

        public java.lang.String[] lookupParameterNames​(java.lang.reflect.AccessibleObject accessible)
        Description copied from interface: Paranamer
        Lookup the parameter names of a given method.
        Specified by:
        lookupParameterNames in interface Paranamer
        Parameters:
        accessible - the Method or Constructor for which the parameter names are looked up.
        Returns:
        A list of the parameter names.
      • lookupParameterNames

        public java.lang.String[] lookupParameterNames​(java.lang.reflect.AccessibleObject accessible,
                                                       boolean throwExceptionIfMissing)
        Description copied from interface: Paranamer
        Lookup the parameter names of a given method.
        Specified by:
        lookupParameterNames in interface Paranamer
        Parameters:
        accessible - the Method or Constructor for which the parameter names are looked up.
        throwExceptionIfMissing - whether to throw an exception if no Paranamer data found (versus return null).
        Returns:
        A list of the parameter names.
      • getConstructorParameterNames

        private java.lang.String[] getConstructorParameterNames​(java.lang.reflect.Constructor<?> cons,
                                                                java.lang.String raw)
      • getMethodParameterNames

        private java.lang.String[] getMethodParameterNames​(java.lang.reflect.Method method,
                                                           java.lang.String raw)
      • getParameterNames

        private java.lang.String[] getParameterNames​(java.lang.reflect.AccessibleObject a,
                                                     java.lang.String name,
                                                     java.lang.Class<?>[] types,
                                                     java.lang.String raw)
      • getJavadocFilename

        protected static java.lang.String getJavadocFilename​(java.lang.reflect.Member member)
      • getCanonicalName

        protected static java.lang.String getCanonicalName​(java.lang.Class<?> klass)
      • streamToString

        protected static java.lang.String streamToString​(java.io.InputStream input)
                                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • urlToStream

        protected static java.io.InputStream urlToStream​(java.net.URL url)
                                                  throws java.io.IOException
        Throws:
        java.io.IOException