public abstract static class MethodDescription.AbstractMethodDescription extends ModifierReviewable.AbstractModifierReviewable implements MethodDescription
MethodDescription.AbstractMethodDescription, MethodDescription.ForLoadedConstructor, MethodDescription.ForLoadedMethod, MethodDescription.Latent
ModifierReviewable.AbstractModifierReviewable
CONSTRUCTOR_INTERNAL_NAME, TYPE_INITIALIZER_INTERNAL_NAME, TYPE_INITIALIZER_MODIFIER
EMPTY_NAME
EMPTY_MASK
Constructor and Description |
---|
AbstractMethodDescription() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
int |
getAdjustedModifiers(boolean nonAbstract)
Returns this method modifier but adjusts its state of being abstract.
|
<T> T |
getDefaultValue(Class<T> type)
Returns the default value but casts it to the given type.
|
String |
getDescriptor()
Returns the descriptor of this byte code element.
|
String |
getGenericSignature()
Returns the generic signature of this byte code element.
|
String |
getName()
Returns the internalName of this byte code element.
|
String |
getSourceCodeName()
Returns the name of this byte code element as it is defined in Java source code.
|
int |
getStackSize()
Returns the size of the local variable array that is required for this method, i.e.
|
String |
getUniqueSignature()
Returns the unique signature of a byte code method.
|
int |
hashCode() |
boolean |
isBootstrap()
Checks if the method is a bootstrap method.
|
boolean |
isBootstrap(List<?> arguments)
Checks if the method is a bootstrap method that accepts the given arguments.
|
boolean |
isConstructor()
Checks if this method description represents a constructor.
|
boolean |
isDefaultMethod()
Checks if this method represents a Java 8+ default method.
|
boolean |
isDefaultValue()
Checks if this method is capable of defining a default annotation value.
|
boolean |
isDefaultValue(Object value)
Checks if the given value can describe a default annotation value for this method.
|
boolean |
isInvokableOn(TypeDescription typeDescription)
Asserts if this method is invokable on an instance of the given type, i.e.
|
boolean |
isMethod()
Checks if this method description represents a method, i.e.
|
boolean |
isOverridable()
Verifies if this method description represents an overridable method.
|
boolean |
isSpecializableFor(TypeDescription targetType)
Checks if this method can be called using the
INVOKESPECIAL for a given type. |
boolean |
isTypeInitializer()
Checks if this method is a type initializer.
|
boolean |
isVisibleTo(TypeDescription typeDescription)
Checks if this element is visible from a given type.
|
boolean |
represents(Constructor<?> constructor)
Verifies if a method description represents a given loaded constructor.
|
boolean |
represents(Method method)
Verifies if a method description represents a given loaded method.
|
String |
toString() |
isAbstract, isAnnotation, isBridge, isDeprecated, isEnum, isFinal, isInterface, isMandated, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSuper, isSynchronized, isSynthetic, isTransient, isVarArgs, isVolatile
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getDefaultValue, getExceptionTypes, getParameters, getReturnType
getInternalName
getModifiers, isAbstract, isAnnotation, isBridge, isDeprecated, isEnum, isFinal, isInterface, isMandated, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSuper, isSynchronized, isSynthetic, isTransient, isVarArgs, isVolatile
getDeclaringType
getDeclaredAnnotations
public String getUniqueSignature()
MethodDescription
getUniqueSignature
in interface MethodDescription
public int getStackSize()
MethodDescription
this
if this method represented a non-static
method.getStackSize
in interface MethodDescription
public boolean isMethod()
MethodDescription
isMethod
in interface MethodDescription
true
if this method description represents a method.public boolean isConstructor()
MethodDescription
isConstructor
in interface MethodDescription
true
if this method description represents a constructor.public boolean isTypeInitializer()
MethodDescription
isTypeInitializer
in interface MethodDescription
true
if this method description represents a type initializer.public boolean represents(Method method)
MethodDescription
represents
in interface MethodDescription
method
- The method to be checked.true
if this method description represents the given loaded method.public boolean represents(Constructor<?> constructor)
MethodDescription
represents
in interface MethodDescription
constructor
- The constructor to be checked.true
if this method description represents the given loaded constructor.public String getName()
NamedElement
getName
in interface NamedElement
public String getSourceCodeName()
NamedElement
NamedElement.getName()
.getSourceCodeName
in interface NamedElement
public String getDescriptor()
ByteCodeElement
getDescriptor
in interface ByteCodeElement
public String getGenericSignature()
ByteCodeElement
getGenericSignature
in interface ByteCodeElement
null
if this element is not generic.public int getAdjustedModifiers(boolean nonAbstract)
MethodDescription
getAdjustedModifiers
in interface MethodDescription
nonAbstract
- true
if the method should be treated as non-abstract.public boolean isVisibleTo(TypeDescription typeDescription)
ByteCodeElement
isVisibleTo
in interface ByteCodeElement
typeDescription
- The type which is checked for its access of this element.true
if this element is visible for typeDescription
.public boolean isOverridable()
MethodDescription
isOverridable
in interface MethodDescription
true
if this method description represents an overridable method.public boolean isDefaultMethod()
MethodDescription
isDefaultMethod
in interface MethodDescription
true
if this method is a default method.public boolean isSpecializableFor(TypeDescription targetType)
MethodDescription
INVOKESPECIAL
for a given type.isSpecializableFor
in interface MethodDescription
targetType
- The type otrue
if this method can be called using the INVOKESPECIAL
instruction
using the given type.public <T> T getDefaultValue(Class<T> type)
MethodDescription
ClassCastException
is thrown.getDefaultValue
in interface MethodDescription
T
- The type to cast the default value to.type
- The type to cast the default value to.public boolean isInvokableOn(TypeDescription typeDescription)
MethodDescription
isInvokableOn
in interface MethodDescription
typeDescription
- The type to check.true
if this method is invokable on an instance of the given type.public boolean isBootstrap()
MethodDescription
isBootstrap
in interface MethodDescription
true
if the method is a bootstrap method.public boolean isBootstrap(List<?> arguments)
MethodDescription
isBootstrap
in interface MethodDescription
arguments
- The arguments that the bootstrap method is expected to accept where primitive values
are to be represented as their wrapper types, loaded types by TypeDescription
,
method handles by JavaInstance.MethodHandle
instances and
method types by JavaInstance.MethodType
instances.true
if the method is a bootstrap method that accepts the given arguments.public boolean isDefaultValue()
MethodDescription
isDefaultValue
in interface MethodDescription
true
if it is possible to define a default annotation value for this method.public boolean isDefaultValue(Object value)
MethodDescription
isDefaultValue
in interface MethodDescription
value
- The value that describes the default annotation value for this method.true
if the given value can describe a default annotation value for this method.Copyright © 2014–2015. All rights reserved.