Top Description Inners Fields Constructors Methods
com.thoughtworks.paranamer

public Class AnnotationParanamer

extends Object
implements Paranamer
Class Inheritance
All Implemented Interfaces
com.thoughtworks.paranamer.Paranamer
Imports
java.lang.annotation.Annotation, java.lang.reflect.AccessibleObject, .Constructor, .Method, javax.inject.Named

Implementation of Paranamer that uses @Named annotation of JSR 330. It is overridable to allow other annotations to be used (JBehave, Guice's original one)
Author
Paul Hammant

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
AnnotationParanamer.Jsr330Helper

This is a different class, because the @Inject jar may not be in the classpath.

Field Summary

Modifier and TypeField and Description
public static final String
private final Paranamer

Constructor Summary

AccessConstructor and Description
public
public

Method Summary

Modifier and TypeMethod and Description
protected String

Returns:

a the name value.
getNamedValue
(Annotation
the annotation in question
ann
)

Override this if you want something other than JSR 330's Named annotation.

protected boolean

Returns:

whether it is the annotation holding the parameter name
isNamed
(Annotation
the annotation in question
ann
)

Override this if you want something other than JSR 330's Named annotation.

public String[]
lookupParameterNames(AccessibleObject
the Method or Constructor for which the parameter names are looked up.
methodOrConstructor
)

Implements com.thoughtworks.paranamer.Paranamer.lookupParameterNames.

Lookup the parameter names of a given method.
public String[]
lookupParameterNames(AccessibleObject
the Method or Constructor for which the parameter names are looked up.
methodOrCtor
,
boolean
whether to throw an exception if no Paranamer data found (versus return null).
throwExceptionIfMissing
)

Implements com.thoughtworks.paranamer.Paranamer.lookupParameterNames.

Lookup the parameter names of a given method.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

__PARANAMER_DATAback to summary
public static final String __PARANAMER_DATA
fallbackback to summary
private final Paranamer fallback

Constructor Detail

AnnotationParanamerback to summary
public AnnotationParanamer()
AnnotationParanamerback to summary
public AnnotationParanamer(Paranamer fallback)

Method Detail

getNamedValueback to summary
protected String getNamedValue(Annotation ann)

Override this if you want something other than JSR 330's Named annotation.

return ((Named) ann).value();
Parameters
ann:Annotation

the annotation in question

Returns:String

a the name value.

isNamedback to summary
protected boolean isNamed(Annotation ann)

Override this if you want something other than JSR 330's Named annotation.

return ann instanceof Named;
Parameters
ann:Annotation

the annotation in question

Returns:boolean

whether it is the annotation holding the parameter name

lookupParameterNamesback to summary
public String[] lookupParameterNames(AccessibleObject methodOrConstructor)

Implements com.thoughtworks.paranamer.Paranamer.lookupParameterNames.

Doc from com.thoughtworks.paranamer.Paranamer.lookupParameterNames.

Lookup the parameter names of a given method.

Parameters
methodOrConstructor:AccessibleObject

the Method or Constructor for which the parameter names are looked up.

Returns:String[]

A list of the parameter names.

lookupParameterNamesback to summary
public String[] lookupParameterNames(AccessibleObject methodOrCtor, boolean throwExceptionIfMissing)

Implements com.thoughtworks.paranamer.Paranamer.lookupParameterNames.

Doc from com.thoughtworks.paranamer.Paranamer.lookupParameterNames.

Lookup the parameter names of a given method.

Parameters
methodOrCtor:AccessibleObject

the Method or Constructor for which the parameter names are looked up.

throwExceptionIfMissing:boolean

whether to throw an exception if no Paranamer data found (versus return null).

Returns:String[]

A list of the parameter names.

com.thoughtworks.paranamer back to summary

public Class AnnotationParanamer.Jsr330Helper

extends Object
Class Inheritance

This is a different class, because the @Inject jar may not be in the classpath.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static String
private static boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Jsr330Helperback to summary
public Jsr330Helper()

Method Detail

getNamedValueback to summary
private static String getNamedValue(Annotation ann)
isNamedback to summary
private static boolean isNamed(Annotation ann)