public class JavadocParanamer extends Object implements Paranamer
Paranamer
which can access Javadocs at runtime to extract
parameter names of methods. Works with:-
Note that this does not perform any caching of entries (except what it finds in the
package-list file, which is very lightweight)... every lookup will involve a disc hit.
If you want to speed up performance, use a CachingParanamer
.
Implementation note: the constructors of this implementation let the client know if I/O problems will stop the recovery of parameter names. It might be preferable to suppress exceptions and simply return NO_PARAMETER_NAMES_LIST.
TODO: example use code
Known issues:-
EMPTY_NAMES
Constructor and Description |
---|
JavadocParanamer(File archiveOrDirectory)
Construct a Javadoc reading implementation of
Paranamer using a local
directory or zip archive as a source. |
JavadocParanamer(URL url) |
Modifier and Type | Method and Description |
---|---|
String[] |
lookupParameterNames(AccessibleObject methodOrConstructor)
Lookup the parameter names of a given method.
|
String[] |
lookupParameterNames(AccessibleObject methodOrConstructor,
boolean throwExceptionIfMissing)
Lookup the parameter names of a given method.
|
public JavadocParanamer(File archiveOrDirectory) throws IOException
Paranamer
using a local
directory or zip archive as a source.archiveOrDirectory
- either a zip archive of Javadocs or the base directory of Javadocs.IOException
- if there was an error when reading from either the archive or the
package-list file.FileNotFoundException
- if the archive, directory or package-list
file does not
exist.NullPointerException
- if any parameter is nullIllegalArgumentException
- If the given parameter is not a file or directory or if it is a file
but not a javadoc zip archive.public JavadocParanamer(URL url) throws IOException
url
- The URL of the JavaDocIOException
- if there was a problem connecting to the remote JavadocsFileNotFoundException
- if the url does not have a /package-list
NullPointerException
- if any parameter is nullpublic String[] lookupParameterNames(AccessibleObject methodOrConstructor)
Paranamer
lookupParameterNames
in interface Paranamer
methodOrConstructor
- the Method
or Constructor
for which the parameter names
are looked up.public String[] lookupParameterNames(AccessibleObject methodOrConstructor, boolean throwExceptionIfMissing)
Paranamer
lookupParameterNames
in interface Paranamer
methodOrConstructor
- 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).Copyright © 2007–2013. All rights reserved.