-
- All Implemented Interfaces:
-
dev.thecodewarrior.mirror.member.ExecutableMirror,dev.thecodewarrior.mirror.member.MemberMirror,dev.thecodewarrior.mirror.util.DeclarationMirror
public interface MethodMirror implements ExecutableMirror
A mirror representing a method.
-
-
Method Summary
Modifier and Type Method Description abstract BooleandoesOverride(Method otherMethod)Returns true if this method overrides the passed method. abstract <T extends Any> Tcall(Object receiver, Object args)Calls the represented method on the passed instance. abstract MethodMirrorwithTypeParameters(TypeMirror parameters)Returns a copy of this mirror, replacing its type parameters the given types. abstract MethodMirrorwithDeclaringClass(ClassMirror enclosing)Returns a copy of this member with its enclosing class replaced with enclosing. abstract MethodgetJava()The Core Reflection object this mirror represents abstract MethodMirrorgetRaw()The mirror representing this member without any generic specialization abstract BooleangetIsAbstract()A shorthand for checking if the abstractmodifier is present on this field.abstract BooleangetIsStatic()A shorthand for checking if the staticmodifier is present on this field.abstract BooleangetIsFinal()A shorthand for checking if the finalmodifier is present on this field.abstract BooleangetIsStrict()A shorthand for checking if the strictfpmodifier is present on this field.abstract BooleangetIsSynchronized()A shorthand for checking if the synchronizedmodifier is present on this field.abstract BooleangetIsNative()A shorthand for checking if the nativemodifier is present on this field.abstract BooleangetIsBridge()Returns true if this method is a bridge method. abstract BooleangetIsDefault()Returns true if this method is a default interface method. abstract ObjectgetDefaultValue()Returns the default value of the annotation method, if it has one. abstract MethodMirrorgetOverrides()Returns the method overridden by this method, if any. abstract Set<Modifier>getModifiers()The set of modifiers present on this member. abstract Modifier.AccessgetAccess()The access control modifier for this member. abstract BooleangetIsVarArgs()Returns true if this method takes a variable number of arguments. abstract BooleangetIsInternalAccess()Returns true if this method/constructor has internal visibility in Kotlin abstract KCallable<?>getKCallable()Returns the Kotlin KCallable instance that represents the same method/constructor as this. abstract StringgetName()The method name. abstract TypeMirrorgetReturnType()abstract List<ParameterMirror>getParameters()abstract List<TypeMirror>getParameterTypes()abstract List<Class<?>>getErasedParameterTypes()Used to determine method override relationships abstract List<TypeMirror>getExceptionTypes()abstract List<TypeMirror>getTypeParameters()abstract BooleangetIsPublic()A shorthand for checking if the publicmodifier is present on this field.abstract BooleangetIsProtected()A shorthand for checking if the protectedmodifier is present on this field.abstract BooleangetIsPrivate()A shorthand for checking if the privatemodifier is present on this field.abstract BooleangetIsPackagePrivate()A shorthand for checking if neither the public,protected, norprivatemodifiers are present on this field.abstract BooleangetIsSynthetic()Returns true if this member is synthetic. abstract BooleangetIsKotlinMember()Returns true if this member is declared in a class directly written in Kotlin abstract AnnotationListgetAnnotations()Returns annotations that are present on the member this mirror represents. abstract AnnotationListgetDeclaredAnnotations()Returns annotations that are declared on the member this mirror represents. abstract ClassMirrorgetDeclaringClass()The specialized class this member is declared in -
Methods inherited from class dev.thecodewarrior.mirror.member.ExecutableMirror
toString -
Methods inherited from class dev.thecodewarrior.mirror.member.MemberMirror
toDeclarationString, toJavaDeclarationString, toKotlinDeclarationString -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
doesOverride
abstract Boolean doesOverride(Method otherMethod)
Returns true if this method overrides the passed method. This performs all its calculations based on this method's declaring class, so if this method is inherited by another class and overrides an interface declared on on that other class, this will not detect that.
-
call
abstract <T extends Any> T call(Object receiver, Object args)
Calls the represented method on the passed instance. If this represents a static method,
nullshould be used for the instance.After the one-time cost of creating the MethodHandle, the access should be near-native speed.
-
withTypeParameters
abstract MethodMirror withTypeParameters(TypeMirror parameters)
Returns a copy of this mirror, replacing its type parameters the given types. Passing zero arguments will return a copy of this mirror with the raw type arguments.
Note: A new mirror is only created if none already exist with the required specialization
-
withDeclaringClass
abstract MethodMirror withDeclaringClass(ClassMirror enclosing)
Returns a copy of this member with its enclosing class replaced with enclosing. Substituting type variables as necessary. If the passed class is null this method removes any enclosing class specialization.
Note: A new mirror is only created if none already exist with the required specialization
-
getRaw
abstract MethodMirror getRaw()
The mirror representing this member without any generic specialization
-
getIsAbstract
abstract Boolean getIsAbstract()
A shorthand for checking if the
abstractmodifier is present on this field.
-
getIsStatic
abstract Boolean getIsStatic()
A shorthand for checking if the
staticmodifier is present on this field.
-
getIsFinal
abstract Boolean getIsFinal()
A shorthand for checking if the
finalmodifier is present on this field.
-
getIsStrict
abstract Boolean getIsStrict()
A shorthand for checking if the
strictfpmodifier is present on this field.
-
getIsSynchronized
abstract Boolean getIsSynchronized()
A shorthand for checking if the
synchronizedmodifier is present on this field.
-
getIsNative
abstract Boolean getIsNative()
A shorthand for checking if the
nativemodifier is present on this field.
-
getIsBridge
abstract Boolean getIsBridge()
Returns true if this method is a bridge method.
-
getIsDefault
abstract Boolean getIsDefault()
Returns true if this method is a default interface method. Implementations of default interface methods don't have this flag. For the default values of annotation parameters, use defaultValue.
-
getDefaultValue
abstract Object getDefaultValue()
Returns the default value of the annotation method, if it has one. Somewhat confusingly, this is entirely distinct from isDefault, despite the similar name.
-
getOverrides
abstract MethodMirror getOverrides()
Returns the method overridden by this method, if any. This will return the method this overrides from its superclass, not from any interfaces.
-
getModifiers
abstract Set<Modifier> getModifiers()
The set of modifiers present on this member. This set is in customary order, as defined in JLS §8.1.1
Note: This set is immutable
-
getAccess
abstract Modifier.Access getAccess()
The access control modifier for this member.
-
getIsVarArgs
abstract Boolean getIsVarArgs()
Returns true if this method takes a variable number of arguments.
-
getIsInternalAccess
abstract Boolean getIsInternalAccess()
Returns true if this method/constructor has internal visibility in Kotlin
-
getKCallable
abstract KCallable<?> getKCallable()
Returns the Kotlin KCallable instance that represents the same method/constructor as this. This is null if this is synthetic or if this is a bridge method. Other cases where no KCallable exists are not yet known, but may exist.
-
getName
abstract String getName()
The method name. The class's binary name for constructors.
-
getReturnType
abstract TypeMirror getReturnType()
-
getParameters
abstract List<ParameterMirror> getParameters()
-
getParameterTypes
abstract List<TypeMirror> getParameterTypes()
-
getErasedParameterTypes
abstract List<Class<?>> getErasedParameterTypes()
Used to determine method override relationships
-
getExceptionTypes
abstract List<TypeMirror> getExceptionTypes()
-
getTypeParameters
abstract List<TypeMirror> getTypeParameters()
-
getIsPublic
abstract Boolean getIsPublic()
A shorthand for checking if the
publicmodifier is present on this field.
-
getIsProtected
abstract Boolean getIsProtected()
A shorthand for checking if the
protectedmodifier is present on this field.
-
getIsPrivate
abstract Boolean getIsPrivate()
A shorthand for checking if the
privatemodifier is present on this field.
-
getIsPackagePrivate
abstract Boolean getIsPackagePrivate()
A shorthand for checking if neither the
public,protected, norprivatemodifiers are present on this field.
-
getIsSynthetic
abstract Boolean getIsSynthetic()
Returns true if this member is synthetic.
-
getIsKotlinMember
abstract Boolean getIsKotlinMember()
Returns true if this member is declared in a class directly written in Kotlin
-
getAnnotations
abstract AnnotationList getAnnotations()
Returns annotations that are present on the member this mirror represents.
-
getDeclaredAnnotations
abstract AnnotationList getDeclaredAnnotations()
Returns annotations that are declared on the member this mirror represents.
-
getDeclaringClass
abstract ClassMirror getDeclaringClass()
The specialized class this member is declared in
-
-
-
-