|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.thoughtworks.paranamer.JavadocParanamer
public class JavadocParanamer
Implementation of 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:-
Field Summary |
---|
Fields inherited from interface com.thoughtworks.paranamer.Paranamer |
---|
EMPTY_NAMES |
Constructor Summary | |
---|---|
JavadocParanamer(File archiveOrDirectory)
Construct a Javadoc reading implementation of Paranamer using a local
directory or zip archive as a source. |
|
JavadocParanamer(URL url)
|
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
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 null
IllegalArgumentException
- 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 JavaDoc
IOException
- if there was a problem connecting to the remote Javadocs
FileNotFoundException
- if the url does not have a /package-list
NullPointerException
- if any parameter is nullMethod Detail |
---|
public 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).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |