public static class TypeDescription.ForLoadedType extends TypeDescription.AbstractTypeDescription
TypeDescription.AbstractTypeDescription, TypeDescription.ForLoadedType
ModifierReviewable.AbstractModifierReviewable
Constructor and Description |
---|
ForLoadedType(Class<?> type)
Creates a new immutable type description for a loaded type.
|
Modifier and Type | Method and Description |
---|---|
<T extends Annotation> |
getAnnotation(Class<T> annotationType) |
Annotation[] |
getAnnotations() |
String |
getCanonicalName()
Returns the canonical internalName of this type.
|
TypeDescription |
getComponentType()
Returns the component type of this type.
|
Annotation[] |
getDeclaredAnnotations() |
FieldList |
getDeclaredFields()
Returns a list of fields that are declared by this type.
|
MethodList |
getDeclaredMethods()
Returns a list of methods that are declared by this type.
|
TypeDescription |
getDeclaringType()
Returns the declaring type of this instance.
|
String |
getDescriptor()
Returns the descriptor of this byte code element.
|
TypeDescription |
getEnclosingClass()
Returns a description of the enclosing type of this type.
|
MethodDescription |
getEnclosingMethod()
Returns a description of the enclosing method of this type.
|
TypeList |
getInterfaces()
Returns a list of interfaces that are implemented by this type.
|
int |
getModifiers()
Returns the modifier that is described by this object.
|
String |
getName()
Returns the internalName of this byte code element.
|
String |
getPackageName()
Returns the package internalName of the type described by this instance.
|
String |
getSimpleName()
Returns the simple internalName of this type.
|
StackSize |
getStackSize()
Returns the size of the type described by this instance.
|
TypeDescription |
getSupertype()
Returns the component type of this type.
|
boolean |
isAnnotation()
Specifies if the modifier described by this object represents the annotation flag.
|
boolean |
isAnnotationPresent(Class<? extends Annotation> annotationClass) |
boolean |
isAnonymousClass()
Checks if this type description represents an anonymous type.
|
boolean |
isArray()
Checks if the type described by this entity is an array
|
boolean |
isAssignableFrom(Class<?> type)
Checks if this type is assignable from the type described by this instance, for example for
class Foo and class Bar extends Foo , this method would return true for
Foo.class.isAssignableFrom(Bar.class) . |
boolean |
isAssignableFrom(TypeDescription typeDescription)
Checks if this type is assignable from the type described by this instance, for example for
class Foo and class Bar extends Foo , this method would return true for
Foo.class.isAssignableFrom(Bar.class) . |
boolean |
isAssignableTo(Class<?> type)
Checks if this type is assignable from the type described by this instance, for example for
class Foo and class Bar extends Foo , this method would return true for
Bar.class.isAssignableTo(Foo.class) . |
boolean |
isAssignableTo(TypeDescription typeDescription)
Checks if this type is assignable from the type described by this instance, for example for
class Foo and class Bar extends Foo , this method would return true for
Bar.class.isAssignableFrom(Foo.class) . |
boolean |
isInstance(Object object)
Checks if
object is an instance of the type represented by this instance. |
boolean |
isInterface()
Specifies if the modifier described by this object represents the interface flag.
|
boolean |
isLocalClass()
Checks if this type description represents a local type.
|
boolean |
isMemberClass()
Checks if this type description represents a member type.
|
boolean |
isPrimitive()
Checks if the type described by this entity is a primitive type.
|
boolean |
isSynthetic()
Specifies if the modifier described by this object is synthetic.
|
boolean |
represents(Class<?> type)
Checks if the type described by this instance represents
type . |
String |
toString() |
equals, getInternalName, getReachableMethods, hashCode, isVisibleTo
isAbstract, isBridge, isDeprecated, isEnum, isFinal, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSuper, isSynchronized, isTransient, isVarArgs, isVolatile
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
isAbstract, isBridge, isDeprecated, isEnum, isFinal, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSuper, isSynchronized, isTransient, isVarArgs, isVolatile
getAnnotationsByType, getDeclaredAnnotation, getDeclaredAnnotationsByType
public ForLoadedType(Class<?> type)
type
- The type to be represented by this type description.public boolean isInstance(Object object)
TypeDescription
object
is an instance of the type represented by this instance.isInstance
in interface TypeDescription
isInstance
in class TypeDescription.AbstractTypeDescription
object
- The object of interest.true
if the object is an instance of the type described by this instance.public boolean isAssignableFrom(Class<?> type)
TypeDescription
class Foo
and class Bar extends Foo
, this method would return true
for
Foo.class.isAssignableFrom(Bar.class)
.type
- The type of interest.true
if this type is assignable from type
.public boolean isAssignableFrom(TypeDescription typeDescription)
TypeDescription
class Foo
and class Bar extends Foo
, this method would return true
for
Foo.class.isAssignableFrom(Bar.class)
.
Implementations of this methods are allowed to delegate to
TypeDescription.isAssignableFrom(Class)
typeDescription
- The type of interest.true
if this type is assignable from type
.public boolean isAssignableTo(Class<?> type)
TypeDescription
class Foo
and class Bar extends Foo
, this method would return true
for
Bar.class.isAssignableTo(Foo.class)
.type
- The type of interest.true
if this type is assignable to type
.public boolean isAssignableTo(TypeDescription typeDescription)
TypeDescription
class Foo
and class Bar extends Foo
, this method would return true
for
Bar.class.isAssignableFrom(Foo.class)
.
Implementations of this methods are allowed to delegate to
TypeDescription.isAssignableTo(Class)
typeDescription
- The type of interest.true
if this type is assignable to type
.public boolean represents(Class<?> type)
TypeDescription
type
.type
- The type of interest.true
if the type described by this instance represents type
.public boolean isInterface()
ModifierReviewable
isInterface
in interface ModifierReviewable
isInterface
in class ModifierReviewable.AbstractModifierReviewable
true
if the modifier described by this object represents the interface flag.public boolean isArray()
TypeDescription
true
if this type description represents an array.public TypeDescription getComponentType()
TypeDescription
null
if this type description does not represent an array.public boolean isPrimitive()
TypeDescription
true
if this type description represents a primitive type.public boolean isAnnotation()
ModifierReviewable
isAnnotation
in interface ModifierReviewable
isAnnotation
in class ModifierReviewable.AbstractModifierReviewable
true
if the modifier described by this object represents the annotation flag.public boolean isSynthetic()
ModifierReviewable
isSynthetic
in interface ModifierReviewable
isSynthetic
in class ModifierReviewable.AbstractModifierReviewable
true
if the modifier described by this object is synthetic.public TypeDescription getSupertype()
TypeDescription
null
if type does not have a super type as for the
Object
type.public TypeList getInterfaces()
TypeDescription
public TypeDescription getDeclaringType()
DeclaredInType
null
if no such type exists.public MethodDescription getEnclosingMethod()
TypeDescription
null
if there is no such method.public TypeDescription getEnclosingClass()
TypeDescription
null
if there is no such type.public String getSimpleName()
TypeDescription
public String getCanonicalName()
TypeDescription
public boolean isAnonymousClass()
TypeDescription
true
if this type description represents an anonymous type.public boolean isLocalClass()
TypeDescription
true
if this type description represents a local type.public boolean isMemberClass()
TypeDescription
true
if this type description represents a member type.public FieldList getDeclaredFields()
TypeDescription
public MethodList getDeclaredMethods()
TypeDescription
public String getPackageName()
TypeDescription
public StackSize getStackSize()
TypeDescription
public String getName()
ByteCodeElement
public String getDescriptor()
ByteCodeElement
public int getModifiers()
ModifierReviewable
public <T extends Annotation> T getAnnotation(Class<T> annotationType)
public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass)
public Annotation[] getAnnotations()
public Annotation[] getDeclaredAnnotations()
Copyright © 2014. All rights reserved.