java.lang.Object
java.lang.reflect.AccessibleObject
java.lang.reflect.Executable
- All Implemented Interfaces:
AnnotatedElement
,GenericDeclaration
,Member
- Direct Known Subclasses:
Constructor
,Method
public abstract class Executable extends AccessibleObject implements Member, GenericDeclaration
A shared superclass for the common functionality of
Method
and Constructor
.- Since:
- 1.8
-
Field Summary
-
Method Summary
Modifier and Type Method Description AnnotatedType[]
getAnnotatedExceptionTypes()
Returns an array ofAnnotatedType
objects that represent the use of types to specify the declared exceptions of the method/constructor represented by this Executable.AnnotatedType[]
getAnnotatedParameterTypes()
Returns an array ofAnnotatedType
objects that represent the use of types to specify formal parameter types of the method/constructor represented by this Executable.AnnotatedType
getAnnotatedReceiverType()
Returns anAnnotatedType
object that represents the use of a type to specify the receiver type of the method/constructor represented by thisExecutable
object.abstract AnnotatedType
getAnnotatedReturnType()
Returns anAnnotatedType
object that represents the use of a type to specify the return type of the method/constructor represented by this Executable.<T extends Annotation>
TgetAnnotation(Class<T> annotationClass)
Returns this element's annotation for the specified type if such an annotation is present, else null.<T extends Annotation>
T[]getAnnotationsByType(Class<T> annotationClass)
Returns annotations that are associated with this element.abstract Class<?>
getDeclaringClass()
Returns theClass
object representing the class or interface that declares the executable represented by this object.abstract Class<?>[]
getExceptionTypes()
Returns an array ofClass
objects that represent the types of exceptions declared to be thrown by the underlying executable represented by this object.Type[]
getGenericExceptionTypes()
Returns an array ofType
objects that represent the exceptions declared to be thrown by this executable object.Type[]
getGenericParameterTypes()
Returns an array ofType
objects that represent the formal parameter types, in declaration order, of the executable represented by this object.abstract int
getModifiers()
Returns the Java language modifiers for the executable represented by this object.abstract String
getName()
Returns the name of the executable represented by this object.abstract Annotation[][]
getParameterAnnotations()
Returns an array of arrays ofAnnotation
s that represent the annotations on the formal parameters, in declaration order, of theExecutable
represented by this object.int
getParameterCount()
Returns the number of formal parameters (whether explicitly declared or implicitly declared or neither) for the executable represented by this object.Parameter[]
getParameters()
Returns an array ofParameter
objects that represent all the parameters to the underlying executable represented by this object.abstract Class<?>[]
getParameterTypes()
Returns an array ofClass
objects that represent the formal parameter types, in declaration order, of the executable represented by this object.abstract TypeVariable<?>[]
getTypeParameters()
Returns an array ofTypeVariable
objects that represent the type variables declared by the generic declaration represented by thisGenericDeclaration
object, in declaration order.boolean
isSynthetic()
Returnstrue
if this executable is a synthetic construct; returnsfalse
otherwise.boolean
isVarArgs()
Returnstrue
if this executable was declared to take a variable number of arguments; returnsfalse
otherwise.abstract String
toGenericString()
Returns a string describing thisExecutable
, including any type parameters.Methods declared in class java.lang.reflect.AccessibleObject
canAccess, getAnnotations, getDeclaredAnnotation, getDeclaredAnnotations, getDeclaredAnnotationsByType, isAccessible, isAnnotationPresent,