public static class InstrumentedType.Default extends TypeDescription.AbstractBase.OfSimpleType implements InstrumentedType
TypeDescription.AbstractBase.OfSimpleType, TypeDescription.AbstractBase.RawTypeWrapper
InstrumentedType.Default, InstrumentedType.TypeInitializer
TypeDescription.AbstractBase, TypeDescription.ArrayProjection, TypeDescription.ForLoadedType, TypeDescription.ForPackageDescription, TypeDescription.Latent
GenericTypeDescription.ForGenericArray, GenericTypeDescription.ForNonGenericType, GenericTypeDescription.ForParameterizedType, GenericTypeDescription.ForTypeVariable, GenericTypeDescription.ForWildcardType, GenericTypeDescription.LazyProjection, GenericTypeDescription.Sort, GenericTypeDescription.SuperTypeIterator, GenericTypeDescription.Visitor<T>
TypeVariableSource.Visitor<T>
ByteCodeElement.Accessible, ByteCodeElement.Token<T extends ByteCodeElement.Token<T>>, ByteCodeElement.TypeDependant<T extends ByteCodeElement.TypeDependant<?,S>,S extends ByteCodeElement.Token<S>>
NamedElement.WithGenericName, NamedElement.WithRuntimeName
ARRAY_INTERFACES, ARRAY_MODIFIERS, CLASS, ENUM, OBJECT, STRING, UNDEFINED, VOID
NON_GENERIC_SIGNATURE
EMPTY_NAME
EMPTY_MASK
Constructor and Description |
---|
Default(String name,
int modifiers,
List<? extends GenericTypeDescription> typeVariables,
GenericTypeDescription superType,
List<? extends GenericTypeDescription> interfaceTypes,
List<? extends FieldDescription.Token> fieldTokens,
List<? extends MethodDescription.Token> methodTokens,
List<? extends AnnotationDescription> annotationDescriptions,
InstrumentedType.TypeInitializer typeInitializer,
LoadedTypeInitializer loadedTypeInitializer)
Creates a new instrumented type with default values for any properties that only exist for types that are declared within another type.
|
Default(String name,
int modifiers,
List<? extends GenericTypeDescription> typeVariables,
GenericTypeDescription superType,
List<? extends GenericTypeDescription> interfaceTypes,
List<? extends FieldDescription.Token> fieldTokens,
List<? extends MethodDescription.Token> methodTokens,
List<? extends AnnotationDescription> annotationDescriptions,
InstrumentedType.TypeInitializer typeInitializer,
LoadedTypeInitializer loadedTypeInitializer,
TypeDescription declaringType,
MethodDescription enclosingMethod,
TypeDescription enclosingType,
List<? extends TypeDescription> declaredTypes,
boolean memberClass,
boolean anonymousClass,
boolean localClass)
Creates a new instrumented type.
|
Modifier and Type | Method and Description |
---|---|
AnnotationList |
getDeclaredAnnotations()
Returns a list of annotations that are declared by this instance.
|
FieldList<FieldDescription.InDefinedShape> |
getDeclaredFields()
Returns a list of field descriptions that are declared by this type.
|
protected GenericTypeList |
getDeclaredInterfaces()
Returns the declared interface types in the form they are declared in the class file.
|
MethodList<MethodDescription.InDefinedShape> |
getDeclaredMethods()
Returns a list of method descriptions that are declared by this type.
|
protected GenericTypeDescription |
getDeclaredSuperType()
Returns the declared super type in the form it is declared in the class file.
|
TypeList |
getDeclaredTypes()
Returns a list of types that are declared by this type excluding anonymous classes.
|
TypeDescription |
getDeclaringType()
Returns the declaring type of this instance.
|
MethodDescription |
getEnclosingMethod()
Returns a description of the enclosing method of this type.
|
TypeDescription |
getEnclosingType()
Returns a description of the enclosing type of this type.
|
LoadedTypeInitializer |
getLoadedTypeInitializer()
Returns the
LoadedTypeInitializer s that were registered
for this instrumented type. |
int |
getModifiers()
Returns the modifier that is described by this object.
|
String |
getName()
Returns the internalName of this byte code element.
|
PackageDescription |
getPackage()
Returns the package internalName of the type described by this instance.
|
InstrumentedType.TypeInitializer |
getTypeInitializer()
Returns this instrumented type's type initializer.
|
GenericTypeList |
getTypeVariables()
Returns the type variables that are declared by this element.
|
boolean |
isAnonymousClass()
Checks if this type description represents an anonymous type.
|
boolean |
isLocalClass()
Checks if this type description represents a local type.
|
boolean |
isMemberClass()
Checks if this type description represents a member type.
|
InstrumentedType |
withField(FieldDescription.Token fieldToken)
Creates a new instrumented type that includes a new field.
|
InstrumentedType |
withInitializer(ByteCodeAppender byteCodeAppender)
Creates a new instrumented type that executes the given initializer in the instrumented type's
type initializer.
|
InstrumentedType |
withInitializer(LoadedTypeInitializer loadedTypeInitializer)
Creates a new instrumented type that includes the given
LoadedTypeInitializer . |
InstrumentedType |
withMethod(MethodDescription.Token methodToken)
Creates a new instrumented type that includes a new method or constructor.
|
getCanonicalName, getComponentType, getDescriptor, getSimpleName, getStackSize, isArray, isPrimitive
accept, accept, asErasure, equals, findVariable, getActualModifiers, getEnclosingSource, getGenericSignature, getInheritedAnnotations, getInterfaces, getInternalName, getLowerBounds, getOwnerType, getParameters, getSort, getSourceCodeName, getSuperType, getSymbol, getTypeName, getUpperBounds, getVariableSource, hashCode, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isAssignableFrom, isAssignableFrom, isAssignableTo, isAssignableTo, isConstantPool, isInstance, isInstanceOrWrapper, isPrimitiveWrapper, isSamePackage, isVisibleTo, iterator, represents, 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
getActualModifiers, getCanonicalName, getComponentType, getInheritedAnnotations, getOwnerType, getSimpleName, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isAssignableFrom, isAssignableFrom, isAssignableTo, isAssignableTo, isConstantPool, isInstance, isInstanceOrWrapper, isPrimitiveWrapper, isSamePackage
accept, asErasure, getInterfaces, getLowerBounds, getParameters, getSort, getStackSize, getSuperType, getSymbol, getTypeName, getUpperBounds, getVariableSource, isArray, isPrimitive, represents
forEach, iterator, spliterator
accept, findVariable, getEnclosingSource
getDescriptor, getGenericSignature, isVisibleTo
getInternalName
getSourceCodeName
isAbstract, isAnnotation, isBridge, isDeprecated, isEnum, isFinal, isInterface, isMandated, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSuper, isSynchronized, isSynthetic, isTransient, isVarArgs, isVolatile
public Default(String name, int modifiers, List<? extends GenericTypeDescription> typeVariables, GenericTypeDescription superType, List<? extends GenericTypeDescription> interfaceTypes, List<? extends FieldDescription.Token> fieldTokens, List<? extends MethodDescription.Token> methodTokens, List<? extends AnnotationDescription> annotationDescriptions, InstrumentedType.TypeInitializer typeInitializer, LoadedTypeInitializer loadedTypeInitializer)
name
- The binary name of the instrumented type.modifiers
- The modifiers of the instrumented type.typeVariables
- A list of type variables of the instrumented type.superType
- The generic super type of the instrumented type.interfaceTypes
- A list of interfaces of the instrumented type.fieldTokens
- A list of field tokens describing the fields of the instrumented type.methodTokens
- A list of method tokens describing the methods of the instrumented type.annotationDescriptions
- A list of annotations of the annotated type.typeInitializer
- The type initializer of the instrumented type.loadedTypeInitializer
- The loaded type initializer of the instrumented type.public Default(String name, int modifiers, List<? extends GenericTypeDescription> typeVariables, GenericTypeDescription superType, List<? extends GenericTypeDescription> interfaceTypes, List<? extends FieldDescription.Token> fieldTokens, List<? extends MethodDescription.Token> methodTokens, List<? extends AnnotationDescription> annotationDescriptions, InstrumentedType.TypeInitializer typeInitializer, LoadedTypeInitializer loadedTypeInitializer, TypeDescription declaringType, MethodDescription enclosingMethod, TypeDescription enclosingType, List<? extends TypeDescription> declaredTypes, boolean memberClass, boolean anonymousClass, boolean localClass)
name
- The binary name of the instrumented type.modifiers
- The modifiers of the instrumented type.typeVariables
- A list of type variables of the instrumented type.superType
- The generic super type of the instrumented type.interfaceTypes
- A list of interfaces of the instrumented type.fieldTokens
- A list of field tokens describing the fields of the instrumented type.methodTokens
- A list of method tokens describing the methods of the instrumented type.annotationDescriptions
- A list of annotations of the annotated type.typeInitializer
- The type initializer of the instrumented type.loadedTypeInitializer
- The loaded type initializer of the instrumented type.declaringType
- The declaring type of the instrumented type or null
if no such type exists.enclosingMethod
- The enclosing method of the instrumented type or null
if no such type exists.enclosingType
- The enclosing type of the instrumented type or null
if no such type exists.declaredTypes
- A list of types that are declared by this type.memberClass
- true
if this type is a member class.anonymousClass
- true
if this type is a anonymous class.localClass
- true
if this type is a local class.public InstrumentedType withField(FieldDescription.Token fieldToken)
InstrumentedType
withField
in interface InstrumentedType
fieldToken
- A token that represents the field's shape. This token must represent types in their detached state.public InstrumentedType withMethod(MethodDescription.Token methodToken)
InstrumentedType
withMethod
in interface InstrumentedType
methodToken
- A token that represents the method's shape. This token must represent types in their detached state.public InstrumentedType withInitializer(LoadedTypeInitializer loadedTypeInitializer)
InstrumentedType
LoadedTypeInitializer
.withInitializer
in interface InstrumentedType
loadedTypeInitializer
- The type initializer to include.public InstrumentedType withInitializer(ByteCodeAppender byteCodeAppender)
InstrumentedType
withInitializer
in interface InstrumentedType
byteCodeAppender
- The byte code to add to the type initializer.public LoadedTypeInitializer getLoadedTypeInitializer()
InstrumentedType
LoadedTypeInitializer
s that were registered
for this instrumented type.getLoadedTypeInitializer
in interface InstrumentedType
public InstrumentedType.TypeInitializer getTypeInitializer()
InstrumentedType
getTypeInitializer
in interface InstrumentedType
public MethodDescription getEnclosingMethod()
TypeDescription
getEnclosingMethod
in interface TypeDescription
null
if there is no such method.public TypeDescription getEnclosingType()
TypeDescription
getEnclosingType
in interface TypeDescription
null
if there is no such type.public TypeList getDeclaredTypes()
TypeDescription
getDeclaredTypes
in interface TypeDescription
public boolean isAnonymousClass()
TypeDescription
isAnonymousClass
in interface TypeDescription
true
if this type description represents an anonymous type.public boolean isLocalClass()
TypeDescription
isLocalClass
in interface TypeDescription
true
if this type description represents a local type.public boolean isMemberClass()
TypeDescription
isMemberClass
in interface TypeDescription
true
if this type description represents a member type.public PackageDescription getPackage()
TypeDescription
getPackage
in interface TypeDescription
public AnnotationList getDeclaredAnnotations()
AnnotatedCodeElement
getDeclaredAnnotations
in interface AnnotatedCodeElement
public TypeDescription getDeclaringType()
DeclaredByType
getDeclaringType
in interface DeclaredByType
getDeclaringType
in interface TypeDescription
null
if no such type exists.protected GenericTypeDescription getDeclaredSuperType()
TypeDescription.AbstractBase
getDeclaredSuperType
in class TypeDescription.AbstractBase
protected GenericTypeList getDeclaredInterfaces()
TypeDescription.AbstractBase
getDeclaredInterfaces
in class TypeDescription.AbstractBase
public FieldList<FieldDescription.InDefinedShape> getDeclaredFields()
GenericTypeDescription
Returns a list of field descriptions that are declared by this type. For parameterized types, all type variables of these fields are resolved to the values of the type variables.
Only non-generic types (GenericTypeDescription.Sort.NON_GENERIC
) and parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED
) define a super type. For a generic array type,
(GenericTypeDescription.Sort.GENERIC_ARRAY
), an empty list is returned. For other generic
types, an IllegalStateException
is thrown.
getDeclaredFields
in interface GenericTypeDescription
getDeclaredFields
in interface TypeDescription
public MethodList<MethodDescription.InDefinedShape> getDeclaredMethods()
GenericTypeDescription
Returns a list of method descriptions that are declared by this type. For parameterized types, all type variables used by these methods are resolved to the values of the type variables.
Only non-generic types (GenericTypeDescription.Sort.NON_GENERIC
) and parameterized types
(GenericTypeDescription.Sort.PARAMETERIZED
) define a super type. For a generic array type,
(GenericTypeDescription.Sort.GENERIC_ARRAY
), an empty list is returned. For other
generic types, an IllegalStateException
is thrown.
getDeclaredMethods
in interface GenericTypeDescription
getDeclaredMethods
in interface TypeDescription
public GenericTypeList getTypeVariables()
TypeVariableSource
getTypeVariables
in interface TypeVariableSource
public int getModifiers()
ModifierReviewable
getModifiers
in interface ModifierReviewable
public String getName()
NamedElement.WithRuntimeName
getName
in interface NamedElement.WithRuntimeName
Copyright © 2014–2015. All rights reserved.