Class ExecutableInfo
- Direct Known Subclasses:
ConstructorInfo,MethodInfo
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedExecutableInfo(ClassInfo declaringClass, Executable e) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionAttempts to callx.setAccessible(and quietly ignores security exceptions.true )forEachParam(Predicate<ParamInfo> filter, Consumer<ParamInfo> action) Performs an action on every parameter that matches the specified filter.final <A extends Annotation>
ExecutableInfoforEachParameterAnnotation(int index, Class<A> type, Predicate<A> predicate, Consumer<A> consumer) Performs an action on all matching parameter annotations at the specified parameter index.final intfuzzyArgsMatch(Class<?>... argTypes) Returns how well this method matches the specified arg types.final intfuzzyArgsMatch(Object... argTypes) Returns how well this method matches the specified arg types.final intfuzzyArgsMatch(ClassInfo... argTypes) Returns how well this method matches the specified arg types.final ClassInfoReturns metadata about the class that declared this method or constructor.Returns the exception types on this executable.final StringReturns the full name of this executable.final ParamInfogetParam(int index) Returns parameter information at the specified index.final intReturns the number of parameters in this executable.Returns the parameters defined on this executable.final ClassInfogetParamType(int index) Returns the parameter type of the parameter at the specified index.Returns the parameter types on this executable.final TypegetRawGenericParamType(int index) Returns the raw generic parameter type of the parameter at the specified index.Returns the raw generic parameter types on this executable.final ParametergetRawParameter(int index) Returns the rawParameterobject that represents the parameter at the specified index.Returns an array of rawParameterobjects that represent all the parameters to the underlying executable represented by this object.final Class<?>getRawParamType(int index) Returns the raw parameter type of the parameter at the specified index.Returns the raw parameter types on this executable.final StringReturns the short name of this executable.final StringReturns the simple name of the underlying method.final booleanhasFuzzyParamTypes(Class<?>... args) Returnstrue if this method has at most only this arguments in any order.final booleanhasFuzzyParamTypes(ClassInfo... args) Returnstrue if this method has at most only this arguments in any order.final booleanhasMatchingParamTypes(Class<?>... args) Returnstrue if this method has the specified argument parent classes.final booleanhasMatchingParamTypes(ClassInfo... args) Returnstrue if this method has the specified argument parent classes.final booleanReturnstrue if this method has this name.final booleanReturnstrue if this method has a name in the specified list.final booleanReturnstrue if this method has a name in the specified set.final booleanReturnstrue if this executable has no parameters.final booleanhasNumParams(int number) Returnstrue if this executable has this number of arguments.final booleanReturnstrue if this executable has at least one parameter.final booleanhasParamTypes(Class<?>... args) Returnstrue if this method has the specified arguments.final booleanhasParamTypes(ClassInfo... args) Returnstrue if this method has the specified arguments.final booleanis(ReflectFlags... flags) Returnstrue if all specified flags are applicable to this field.final booleanReturnstrue if this method is abstract.final booleanisAll(ReflectFlags... flags) Returnstrue if all specified flags are applicable to this method.final booleanisAny(ReflectFlags... flags) Returnstrue if all specified flags are applicable to this method.final booleanReturnstrue if this executable represents aConstructor.final booleanReturnstrue if this method has the@Deprecatedannotation on it.final booleanReturnstrue if this method is not abstract.final booleanReturnstrue if this method doesn't have the@Deprecatedannotation on it.final booleanReturnstrue if this method is not protected.final booleanReturnstrue if this method is not public.final booleanReturnstrue if this method is not static.final booleanReturnstrue if this method is protected.final booleanisPublic()Returnstrue if this method is public.final booleanisStatic()Returnstrue if this method is static.final booleanIdentifies if the specified visibility matches this method.final booleanAttempts to callx.setAccessible(and quietly ignores security exceptions.true )toString()
-
Constructor Details
-
ExecutableInfo
Constructor.- Parameters:
declaringClass- The class that declares this method or constructor.e- The constructor or method that this info represents.
-
-
Method Details
-
getDeclaringClass
Returns metadata about the class that declared this method or constructor.- Returns:
- Metadata about the class that declared this method or constructor.
-
isConstructor
Returnstrue if this executable represents aConstructor.- Returns:
true if this executable represents aConstructorand can be cast toConstructorInfo.false if this executable represents aMethodand can be cast toMethodInfo.
-
getParamCount
Returns the number of parameters in this executable.Same as calling
Executable.getParameterCount().- Returns:
- The number of parameters in this executable.
-
hasParams
Returnstrue if this executable has at least one parameter.Same as calling
Executable.getParameterCount()and comparing with zero.- Returns:
true if this executable has at least one parameter.
-
hasNoParams
Returnstrue if this executable has no parameters.Same as calling
Executable.getParameterCount()and comparing with zero.- Returns:
true if this executable has no parameters.
-
hasNumParams
Returnstrue if this executable has this number of arguments.Same as calling
Executable.getParameterCount()and comparing the count.- Parameters:
number- The number of expected arguments.- Returns:
true if this executable has this number of arguments.
-
getParams
Returns the parameters defined on this executable.Same as calling
Executable.getParameters()but wraps the results- Returns:
- An array of parameter information, never
null .
-
forEachParam
Performs an action on every parameter that matches the specified filter.- Parameters:
filter- The filter, can benull .action- The action to perform.- Returns:
- This object.
-
getParam
Returns parameter information at the specified index.- Parameters:
index- The parameter index.- Returns:
- The parameter information, never
null .
-
getParamTypes
Returns the parameter types on this executable.- Returns:
- The parameter types on this executable.
-
getParamType
Returns the parameter type of the parameter at the specified index.- Parameters:
index- The parameter index.- Returns:
- The parameter type of the parameter at the specified index.
-
getRawParamTypes
Returns the raw parameter types on this executable.- Returns:
- The raw parameter types on this executable.
-
getRawParamType
Returns the raw parameter type of the parameter at the specified index.- Parameters:
index- The parameter index.- Returns:
- The raw parameter type of the parameter at the specified index.
-
getRawGenericParamTypes
Returns the raw generic parameter types on this executable.- Returns:
- The raw generic parameter types on this executable.
-
getRawGenericParamType
Returns the raw generic parameter type of the parameter at the specified index.- Parameters:
index- The parameter index.- Returns:
- The raw generic parameter type of the parameter at the specified index.
-
getRawParameters
Returns an array of rawParameterobjects that represent all the parameters to the underlying executable represented by this object.- Returns:
- An array of raw
Parameterobjects, or an empty array if executable has no parameters. - See Also:
-
getRawParameter
Returns the rawParameterobject that represents the parameter at the specified index.- Parameters:
index- The parameter index.- Returns:
- The raw
Parameterobject that represents the parameter at the specified index. - See Also:
-
forEachParameterAnnotation
public final <A extends Annotation> ExecutableInfo forEachParameterAnnotation(int index, Class<A> type, Predicate<A> predicate, Consumer<A> consumer) Performs an action on all matching parameter annotations at the specified parameter index.- Type Parameters:
A- The annotation type.- Parameters:
index- The parameter index.type- The annotation type.predicate- The predicate.consumer- The consumer.- Returns:
- This object.
-
getExceptionTypes
Returns the exception types on this executable.- Returns:
- The exception types on this executable.
-
isAll
Returnstrue if all specified flags are applicable to this method.- Parameters:
flags- The flags to test for.- Returns:
true if all specified flags are applicable to this method.
-
is
Returnstrue if all specified flags are applicable to this field.- Parameters:
flags- The flags to test for.- Returns:
true if all specified flags are applicable to this field.
-
isAny
Returnstrue if all specified flags are applicable to this method.- Parameters:
flags- The flags to test for.- Returns:
true if all specified flags are applicable to this method.
-
hasParamTypes
Returnstrue if this method has the specified arguments.- Parameters:
args- The arguments to test for.- Returns:
true if this method has this arguments in the exact order.
-
hasParamTypes
Returnstrue if this method has the specified arguments.- Parameters:
args- The arguments to test for.- Returns:
true if this method has this arguments in the exact order.
-
hasMatchingParamTypes
Returnstrue if this method has the specified argument parent classes.- Parameters:
args- The arguments to test for.- Returns:
true if this method has this arguments in the exact order.
-
hasMatchingParamTypes
Returnstrue if this method has the specified argument parent classes.- Parameters:
args- The arguments to test for.- Returns:
true if this method has this arguments in the exact order.
-
hasFuzzyParamTypes
Returnstrue if this method has at most only this arguments in any order.- Parameters:
args- The arguments to test for.- Returns:
true if this method has at most only this arguments in any order.
-
fuzzyArgsMatch
Returns how well this method matches the specified arg types.The number returned is the number of method arguments that match the passed in arg types.
Returns-1 if the method cannot take in one or more of the specified arguments.- Parameters:
argTypes- The arg types to check against.- Returns:
- How many parameters match or
-1 if method cannot handle one or more of the arguments.
-
fuzzyArgsMatch
Returns how well this method matches the specified arg types.The number returned is the number of method arguments that match the passed in arg types.
Returns-1 if the method cannot take in one or more of the specified arguments.- Parameters:
argTypes- The arg types to check against.- Returns:
- How many parameters match or
-1 if method cannot handle one or more of the arguments.
-
hasFuzzyParamTypes
Returnstrue if this method has at most only this arguments in any order.- Parameters:
args- The arguments to test for.- Returns:
true if this method has at most only this arguments in any order.
-
fuzzyArgsMatch
Returns how well this method matches the specified arg types.The number returned is the number of method arguments that match the passed in arg types.
Returns-1 if the method cannot take in one or more of the specified arguments.- Parameters:
argTypes- The arg types to check against.- Returns:
- How many parameters match or
-1 if method cannot handle one or more of the arguments.
-
isDeprecated
Returnstrue if this method has the@Deprecatedannotation on it.- Returns:
true if this method has the@Deprecatedannotation on it.
-
isNotDeprecated
Returnstrue if this method doesn't have the@Deprecatedannotation on it.- Returns:
true if this method doesn't have the@Deprecatedannotation on it.
-
isAbstract
Returnstrue if this method is abstract.- Returns:
true if this method is abstract.
-
isNotAbstract
Returnstrue if this method is not abstract.- Returns:
true if this method is not abstract.
-
isPublic
Returnstrue if this method is public.- Returns:
true if this method is public.
-
isNotPublic
Returnstrue if this method is not public.- Returns:
true if this method is not public.
-
isProtected
Returnstrue if this method is protected.- Returns:
true if this method is protected.
-
isNotProtected
Returnstrue if this method is not protected.- Returns:
true if this method is not protected.
-
isStatic
Returnstrue if this method is static.- Returns:
true if this method is static.
-
isNotStatic
Returnstrue if this method is not static.- Returns:
true if this method is not static.
-
accessible
Attempts to callx.setAccessible(and quietly ignores security exceptions.true )- Returns:
- This object.
-
setAccessible
Attempts to callx.setAccessible(and quietly ignores security exceptions.true )- Returns:
true if call was successful.
-
isVisible
Identifies if the specified visibility matches this method.- Parameters:
v- The visibility to validate against.- Returns:
true if this visibility matches the modifier attribute of this method.
-
hasName
Returnstrue if this method has this name.- Parameters:
name- The name to test for.- Returns:
true if this method has this name.
-
hasName
Returnstrue if this method has a name in the specified list.- Parameters:
names- The names to test for.- Returns:
true if this method has one of the names.
-
hasName
Returnstrue if this method has a name in the specified set.- Parameters:
names- The names to test for.- Returns:
true if this method has one of the names.
-
getFullName
Returns the full name of this executable.Examples:
"com.foo.MyClass.get(java.util.String)" - Method."com.foo.MyClass(java.util.String)" - Constructor.
- Returns:
- The underlying executable name.
-
getShortName
Returns the short name of this executable.Examples:
"MyClass.get(String)" - Method."MyClass(String)" - Constructor.
- Returns:
- The underlying executable name.
-
getSimpleName
Returns the simple name of the underlying method.- Returns:
- The simple name of the underlying method;
-
toString
-