Class ParamInfo
See Also:
-
Constructor Summary
ModifierConstructorDescriptionprotected
ParamInfo
(ExecutableInfo eInfo, Parameter p, int index) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionPerforms an action on this object if the specified predicate test passes.boolean
Returnstrue if this parameter can accept the specified value.<A extends Annotation>
ParamInfoforEachAnnotation
(Class<A> type, Predicate<A> filter, Consumer<A> action) Performs an action on all matching annotations on this parameter.<A extends Annotation>
ParamInfoforEachDeclaredAnnotation
(Class<A> type, Predicate<A> filter, Consumer<A> action) Performs an action on all matching annotations declared on this parameter.<A extends Annotation>
AgetAnnotation
(Class<A> type) Finds the annotation of the specified type defined on this method parameter.<A extends Annotation>
AgetAnnotation
(Class<A> type, Predicate<A> filter) Returns the first matching annotation on this method parameter.Returns the constructor that this parameter belongs to.<A extends Annotation>
AgetDeclaredAnnotation
(Class<A> type) Returns the specified parameter annotation declared on this parameter.int
getIndex()
Returns the index position of this parameter.Returns the method that this parameter belongs to.getName()
Returns the name of the parameter.Returns the class type of this parameter.<A extends Annotation>
booleanhasAnnotation
(Class<A> type) Returnstrue if this parameter has the specified annotation.boolean
hasName()
Returnstrue if the parameter has a name provided by the class file.<A extends Annotation>
booleanhasNoAnnotation
(Class<A> type) Returnstrue if this parameter doesn't have the specified annotation.boolean
Returnstrue if the parameter type is an exact match for the specified class.boolean
Returnstrue if this object passes the specified predicate test.toString()
-
Constructor Details
-
ParamInfo
Constructor.- Parameters:
eInfo
- The constructor or method wrapper.p
- The parameter being wrapped.index
- The parameter index.
-
-
Method Details
-
getIndex
Returns the index position of this parameter.- Returns:
- The index position of this parameter.
-
getMethod
Returns the method that this parameter belongs to.- Returns:
- The method that this parameter belongs to, or
null if it belongs to a constructor.
-
getConstructor
Returns the constructor that this parameter belongs to.- Returns:
- The constructor that this parameter belongs to, or
null if it belongs to a method.
-
getParameterType
Returns the class type of this parameter.- Returns:
- The class type of this parameter.
-
forEachDeclaredAnnotation
public <A extends Annotation> ParamInfo forEachDeclaredAnnotation(Class<A> type, Predicate<A> filter, Consumer<A> action) Performs an action on all matching annotations declared on this parameter.- Type Parameters:
A
- The annotation type to look for.- Parameters:
type
- The annotation type to look for.filter
- A predicate to apply to the entries to determine if action should be performed. Can benull .action
- An action to perform on the entry.- Returns:
- This object.
-
getDeclaredAnnotation
Returns the specified parameter annotation declared on this parameter.- Type Parameters:
A
- The annotation type to look for.- Parameters:
type
- The annotation type to look for.- Returns:
- The specified parameter annotation declared on this parameter, or
null if not found.
-
getAnnotation
Finds the annotation of the specified type defined on this method parameter.If the annotation cannot be found on the immediate method, searches methods with the same signature on the parent classes or interfaces.
The search is performed in child-to-parent order.If still not found, searches for the annotation on the return type of the method.
- Type Parameters:
A
- The annotation type to look for.- Parameters:
type
- The annotation type to look for.- Returns:
- The annotation if found, or
null if not.
-
hasAnnotation
Returnstrue if this parameter has the specified annotation.- Type Parameters:
A
- The annotation type to look for.- Parameters:
type
- The annotation type to look for.- Returns:
- The
true if annotation if found.
-
hasNoAnnotation
Returnstrue if this parameter doesn't have the specified annotation.- Type Parameters:
A
- The annotation type to look for.- Parameters:
type
- The annotation type to look for.- Returns:
- The
true if annotation if not found.
-
forEachAnnotation
public <A extends Annotation> ParamInfo forEachAnnotation(Class<A> type, Predicate<A> filter, Consumer<A> action) Performs an action on all matching annotations on this parameter.Searches all methods with the same signature on the parent classes or interfaces and the return type on the method.
Results are in parent-to-child order.
- Type Parameters:
A
- The annotation type to look for.- Parameters:
type
- The annotation type to look for.filter
- A predicate to apply to the entries to determine if action should be performed. Can benull .action
- An action to perform on the entry.- Returns:
- This object.
-
getAnnotation
Returns the first matching annotation on this method parameter.Searches all methods with the same signature on the parent classes or interfaces and the return type on the method.
Results are in parent-to-child order.
- Type Parameters:
A
- The annotation type to look for.- Parameters:
type
- The annotation type to look for.filter
- A predicate to apply to the entries to determine if value should be used. Can benull .- Returns:
- A list of all matching annotations found or an empty list if none found.
-
matches
Returnstrue if this object passes the specified predicate test.- Parameters:
test
- The test to perform.- Returns:
true if this object passes the specified predicate test.
-
accept
Performs an action on this object if the specified predicate test passes.- Parameters:
test
- A test to apply to determine if action should be executed. Can benull .action
- An action to perform on this object.- Returns:
- This object.
-
isType
Returnstrue if the parameter type is an exact match for the specified class.- Parameters:
c
- The type to check.- Returns:
true if the parameter type is an exact match for the specified class.
-
hasName
Returnstrue if the parameter has a name provided by the class file.- Returns:
true if the parameter has a name provided by the class file.
-
getName
Returns the name of the parameter.If the parameter's name is present, then this method returns the name provided by the class file. Otherwise, this method synthesizes a name of the form argN, where N is the index of the parameter in the descriptor of the method which declares the parameter.
- Returns:
- The name of the parameter.
- See Also:
-
canAccept
Returnstrue if this parameter can accept the specified value.- Parameters:
value
- The value to check.- Returns:
true if this parameter can accept the specified value.
-
toString
-