Package com.badlogic.gdx.utils.reflect
Class Method
- java.lang.Object
-
- com.badlogic.gdx.utils.reflect.Method
-
public final class Method extends java.lang.Object
Provides information about, and access to, a single method on a class or interface.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Annotation
getDeclaredAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns anAnnotation
object reflecting the annotation provided, or null of this method doesn't have such an annotation.Annotation[]
getDeclaredAnnotations()
Returns an array ofAnnotation
objects reflecting all annotations declared by this method, or an empty array if there are none.java.lang.Class
getDeclaringClass()
Returns the Class object representing the class or interface that declares the method.java.lang.String
getName()
Returns the name of the method.java.lang.Class[]
getParameterTypes()
Returns an array of Class objects that represent the formal parameter types, in declaration order, of the method.java.lang.Class
getReturnType()
Returns a Class object that represents the formal return type of the method.java.lang.Object
invoke(java.lang.Object obj, java.lang.Object... args)
Invokes the underlying method on the supplied object with the supplied parameters.boolean
isAbstract()
Return true if the method includes theabstract
modifier.boolean
isAccessible()
boolean
isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns true if the method includes an annotation of the provided class type.boolean
isDefaultAccess()
Return true if the method does not include any of theprivate
,protected
, orpublic
modifiers.boolean
isFinal()
Return true if the method includes thefinal
modifier.boolean
isNative()
Return true if the method includes thenative
modifier.boolean
isPrivate()
Return true if the method includes theprivate
modifier.boolean
isProtected()
Return true if the method includes theprotected
modifier.boolean
isPublic()
Return true if the method includes thepublic
modifier.boolean
isStatic()
Return true if the method includes thestatic
modifier.boolean
isVarArgs()
Return true if the method takes a variable number of arguments.void
setAccessible(boolean accessible)
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Returns the name of the method.
-
getReturnType
public java.lang.Class getReturnType()
Returns a Class object that represents the formal return type of the method.
-
getParameterTypes
public java.lang.Class[] getParameterTypes()
Returns an array of Class objects that represent the formal parameter types, in declaration order, of the method.
-
getDeclaringClass
public java.lang.Class getDeclaringClass()
Returns the Class object representing the class or interface that declares the method.
-
isAccessible
public boolean isAccessible()
-
setAccessible
public void setAccessible(boolean accessible)
-
isAbstract
public boolean isAbstract()
Return true if the method includes theabstract
modifier.
-
isDefaultAccess
public boolean isDefaultAccess()
Return true if the method does not include any of theprivate
,protected
, orpublic
modifiers.
-
isFinal
public boolean isFinal()
Return true if the method includes thefinal
modifier.
-
isPrivate
public boolean isPrivate()
Return true if the method includes theprivate
modifier.
-
isProtected
public boolean isProtected()
Return true if the method includes theprotected
modifier.
-
isPublic
public boolean isPublic()
Return true if the method includes thepublic
modifier.
-
isNative
public boolean isNative()
Return true if the method includes thenative
modifier.
-
isStatic
public boolean isStatic()
Return true if the method includes thestatic
modifier.
-
isVarArgs
public boolean isVarArgs()
Return true if the method takes a variable number of arguments.
-
invoke
public java.lang.Object invoke(java.lang.Object obj, java.lang.Object... args) throws ReflectionException
Invokes the underlying method on the supplied object with the supplied parameters.- Throws:
ReflectionException
-
isAnnotationPresent
public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns true if the method includes an annotation of the provided class type.
-
getDeclaredAnnotations
public Annotation[] getDeclaredAnnotations()
Returns an array ofAnnotation
objects reflecting all annotations declared by this method, or an empty array if there are none. Does not include inherited annotations. Does not include parameter annotations.
-
getDeclaredAnnotation
public Annotation getDeclaredAnnotation(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
Returns anAnnotation
object reflecting the annotation provided, or null of this method doesn't have such an annotation. This is a convenience function if the caller knows already which annotation type he's looking for.
-
-