public static class InstrumentedType.Default extends TypeDescription.AbstractBase.OfSimpleType implements InstrumentedType.WithFlexibleName
TypeDescription.AbstractBase.OfSimpleType.WithDelegation
TypeDescription.AbstractBase.OfSimpleType
InstrumentedType.Default, InstrumentedType.Factory, InstrumentedType.Frozen, InstrumentedType.Prepareable, InstrumentedType.WithFlexibleName
TypeDescription.AbstractBase, TypeDescription.ArrayProjection, TypeDescription.ForLoadedType, TypeDescription.ForPackageDescription, TypeDescription.Generic, TypeDescription.Latent, TypeDescription.SuperTypeLoading
TypeDefinition.Sort, TypeDefinition.SuperClassIterator
ModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumeration
ByteCodeElement.Token<T extends ByteCodeElement.Token<T>>, ByteCodeElement.TypeDependant<T extends ByteCodeElement.TypeDependant<?,S>,S extends ByteCodeElement.Token<S>>
NamedElement.WithGenericName, NamedElement.WithOptionalName, NamedElement.WithRuntimeName
AnnotationSource.Empty, AnnotationSource.Explicit
TypeVariableSource.Visitor<T>
Modifier and Type | Field and Description |
---|---|
private java.util.List<? extends AnnotationDescription> |
annotationDescriptions
A list of annotations of the annotated type.
|
private boolean |
anonymousClass
true if this type is a anonymous class. |
private java.util.List<? extends TypeDescription> |
declaredTypes
A list of types that are declared by this type.
|
private TypeDescription |
declaringType
The declaring type of the instrumented type or
null if no such type exists. |
private MethodDescription.InDefinedShape |
enclosingMethod
The enclosing method of the instrumented type or
null if no such type exists. |
private TypeDescription |
enclosingType
The enclosing type of the instrumented type or
null if no such type exists. |
private java.util.List<? extends FieldDescription.Token> |
fieldTokens
A list of field tokens describing the fields of the instrumented type.
|
private java.util.List<? extends TypeDescription.Generic> |
interfaceTypes
A list of interfaces of the instrumented type.
|
private static java.util.Set<java.lang.String> |
KEYWORDS
A set containing all keywords of the Java programming language.
|
private LoadedTypeInitializer |
loadedTypeInitializer
The loaded type initializer of the instrumented type.
|
private boolean |
localClass
true if this type is a local class. |
private java.util.List<? extends MethodDescription.Token> |
methodTokens
A list of method tokens describing the methods of the instrumented type.
|
private int |
modifiers
The modifiers of the instrumented type.
|
private java.lang.String |
name
The binary name of the instrumented type.
|
private TypeDescription |
nestHost
The nest host of this instrumented type or a description of
TargetType if this type is its own nest host. |
private java.util.List<? extends TypeDescription> |
nestMembers
A list of all members of this types nest group excluding this type.
|
private TypeDescription.Generic |
superClass
The generic super type of the instrumented type.
|
private TypeInitializer |
typeInitializer
The type initializer of the instrumented type.
|
private java.util.List<? extends TypeVariableToken> |
typeVariables
The instrumented type's type variables in their tokenized form.
|
RAW_TYPES
ARRAY_INTERFACES, CLASS, OBJECT, STRING, THROWABLE, UNDEFINED, VOID
RAW_TYPES_PROPERTY
EMPTY_MASK
NON_GENERIC_SIGNATURE
EMPTY_NAME, NO_NAME
Modifier | Constructor and Description |
---|---|
protected |
Default(java.lang.String name,
int modifiers,
TypeDescription.Generic superClass,
java.util.List<? extends TypeVariableToken> typeVariables,
java.util.List<? extends TypeDescription.Generic> interfaceTypes,
java.util.List<? extends FieldDescription.Token> fieldTokens,
java.util.List<? extends MethodDescription.Token> methodTokens,
java.util.List<? extends AnnotationDescription> annotationDescriptions,
TypeInitializer typeInitializer,
LoadedTypeInitializer loadedTypeInitializer,
TypeDescription declaringType,
MethodDescription.InDefinedShape enclosingMethod,
TypeDescription enclosingType,
java.util.List<? extends TypeDescription> declaredTypes,
boolean anonymousClass,
boolean localClass,
TypeDescription nestHost,
java.util.List<? extends TypeDescription> nestMembers)
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 the fields that this type declares.
|
MethodList<MethodDescription.InDefinedShape> |
getDeclaredMethods()
Returns the methods that this type declares.
|
TypeList |
getDeclaredTypes()
Returns a list of types that are declared by this type.
|
TypeDescription |
getDeclaringType()
Returns the declaring type of this instance.
|
MethodDescription.InDefinedShape |
getEnclosingMethod()
Returns a description of the method that encloses this type.
|
TypeDescription |
getEnclosingType()
Returns a description of this type's enclosing type if any.
|
TypeList.Generic |
getInterfaces()
Returns the interfaces that this type implements.
|
LoadedTypeInitializer |
getLoadedTypeInitializer()
Returns the
LoadedTypeInitializer s that were registered
for this instrumented type. |
int |
getModifiers()
Returns the modifier that is described by this object.
|
java.lang.String |
getName()
Returns the internalName of this byte code element.
|
TypeDescription |
getNestHost()
Returns the nest host of this type.
|
TypeList |
getNestMembers()
Returns a list of members that are part of a nesting group.
|
PackageDescription |
getPackage()
Returns the package of the type described by this instance or
null if the described type does not imply a package. |
TypeDescription.Generic |
getSuperClass()
Returns the super class of this type.
|
TypeInitializer |
getTypeInitializer()
Returns this instrumented type's type initializer.
|
TypeList.Generic |
getTypeVariables()
Returns the type variables that are declared by this element.
|
boolean |
isAnonymousType()
Checks if this type description represents an anonymous type.
|
boolean |
isLocalType()
Checks if this type description represents a local type.
|
private static boolean |
isValidIdentifier(java.lang.String identifier)
Checks if a Java identifier is valid.
|
private static boolean |
isValidIdentifier(java.lang.String[] identifier)
Checks if an array of identifiers is a valid compound Java identifier.
|
static InstrumentedType |
of(java.lang.String name,
TypeDescription.Generic superClass,
int modifiers)
Creates a new instrumented type.
|
static InstrumentedType |
of(java.lang.String name,
TypeDescription.Generic superClass,
ModifierContributor.ForType... modifierContributor)
Creates a new instrumented type.
|
TypeDescription |
validated()
Validates the instrumented type to define a legal Java type.
|
InstrumentedType.WithFlexibleName |
withAnnotations(java.util.List<? extends AnnotationDescription> annotationDescriptions)
Creates a new instrumented type with the given annotations.
|
InstrumentedType.WithFlexibleName |
withAnonymousClass(boolean anonymousClass)
Creates a new instrumented type that indicates that is defined as an anonymous class.
|
InstrumentedType.WithFlexibleName |
withDeclaredTypes(TypeList declaredTypes)
Creates a new instrumented type that indicates that it declared the supplied types.
|
InstrumentedType.WithFlexibleName |
withDeclaringType(TypeDescription declaringType)
Creates a new instrumented type that is declared by the supplied type..
|
InstrumentedType.WithFlexibleName |
withEnclosingMethod(MethodDescription.InDefinedShape enclosingMethod)
Creates a new instrumented type with the supplied enclosing method.
|
InstrumentedType.WithFlexibleName |
withEnclosingType(TypeDescription enclosingType)
Creates a new instrumented type with the supplied enclosing type.
|
InstrumentedType.WithFlexibleName |
withField(FieldDescription.Token token)
Creates a new instrumented type that includes a new field.
|
InstrumentedType.WithFlexibleName |
withInitializer(ByteCodeAppender byteCodeAppender)
Creates a new instrumented type that executes the given initializer in the instrumented type's
type initializer.
|
InstrumentedType.WithFlexibleName |
withInitializer(LoadedTypeInitializer loadedTypeInitializer)
Creates a new instrumented type that includes the given
LoadedTypeInitializer . |
InstrumentedType.WithFlexibleName |
withInterfaces(TypeList.Generic interfaceTypes)
Creates a new instrumented type with the given interfaces implemented.
|
InstrumentedType.WithFlexibleName |
withLocalClass(boolean localClass)
Creates a new instrumented type that indicates that is defined as a local class.
|
InstrumentedType.WithFlexibleName |
withMethod(MethodDescription.Token token)
Creates a new instrumented type that includes a new method or constructor.
|
InstrumentedType.WithFlexibleName |
withModifiers(int modifiers)
Creates a new instrumented type with changed modifiers.
|
InstrumentedType.WithFlexibleName |
withName(java.lang.String name)
Creates a new instrumented type with a changed name.
|
InstrumentedType.WithFlexibleName |
withNestHost(TypeDescription nestHost)
Creates a new instrumented type with the supplied nest host.
|
InstrumentedType.WithFlexibleName |
withNestMembers(TypeList nestMembers)
Creates a new instrumented types with the supplied nest members added to this instrumented type.
|
InstrumentedType.WithFlexibleName |
withTypeVariable(TypeVariableToken typeVariable)
Creates a new instrumented type with the given type variable defined.
|
InstrumentedType.WithFlexibleName |
withTypeVariables(ElementMatcher<? super TypeDescription.Generic> matcher,
Transformer<TypeVariableToken> transformer)
Applies a transformation onto all existing type variables of this instrumented type.
|
getCanonicalName, getComponentType, getDescriptor, getSimpleName, getStackSize, isArray, isPrimitive
accept, asBoxed, asErasure, asGenericType, asUnboxed, equals, getActualModifiers, getActualName, getDefaultValue, getEnclosingSource, getGenericSignature, getInheritedAnnotations, getInnerClassCount, getInternalName, getSort, getTypeName, hashCode, isAccessibleTo, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isAssignableFrom, isAssignableFrom, isAssignableTo, isAssignableTo, isGenerified, isInHierarchyWith, isInHierarchyWith, isInnerClass, isInstance, isMemberType, isNestedClass, isNestHost, isNestMateOf, isNestMateOf, isPackageType, isPrimitiveWrapper, isSamePackage, isVisibleTo, iterator, represents, toString
findVariable
getEnumerationState, getFieldManifestation, getFieldPersistence, getMethodManifestation, getMethodStrictness, getOwnership, getParameterManifestation, getProvisioningState, getSynchronizationState, getSyntheticState, getTypeManifestation, getVisibility, isAbstract, isAnnotation, isBridge, isDeprecated, isEnum, isFinal, isInterface, isMandated, isNative, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStrict, isSynchronized, isSynthetic, isTransient, isVarArgs, isVolatile
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
asBoxed, asUnboxed, getActualModifiers, getCanonicalName, getComponentType, getDefaultValue, getInheritedAnnotations, getInnerClassCount, getSimpleName, isAnnotationReturnType, isAnnotationValue, isAnnotationValue, isAssignableFrom, isAssignableFrom, isAssignableTo, isAssignableTo, isInHierarchyWith, isInHierarchyWith, isInnerClass, isInstance, isMemberType, isNestedClass, isNestHost, isNestMateOf, isNestMateOf, isPackageType, isPrimitiveWrapper, isSamePackage
asErasure, asGenericType, getSort, getStackSize, getTypeName, isArray, isPrimitive, represents
getTypeManifestation, isAnnotation, isInterface
isAbstract
getEnumerationState, isEnum
getOwnership, getVisibility, isDeprecated, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic
getSyntheticState, isFinal, isSynthetic
getDescriptor, getGenericSignature, isAccessibleTo, isVisibleTo
getInternalName
getActualName
accept, findVariable, getEnclosingSource, isGenerified
private static final java.util.Set<java.lang.String> KEYWORDS
private final java.lang.String name
private final int modifiers
private final TypeDescription.Generic superClass
private final java.util.List<? extends TypeVariableToken> typeVariables
private final java.util.List<? extends TypeDescription.Generic> interfaceTypes
private final java.util.List<? extends FieldDescription.Token> fieldTokens
private final java.util.List<? extends MethodDescription.Token> methodTokens
private final java.util.List<? extends AnnotationDescription> annotationDescriptions
private final TypeInitializer typeInitializer
private final LoadedTypeInitializer loadedTypeInitializer
private final TypeDescription declaringType
null
if no such type exists.private final MethodDescription.InDefinedShape enclosingMethod
null
if no such type exists.private final TypeDescription enclosingType
null
if no such type exists.private final java.util.List<? extends TypeDescription> declaredTypes
private final boolean anonymousClass
true
if this type is a anonymous class.private final boolean localClass
true
if this type is a local class.private final TypeDescription nestHost
TargetType
if this type is its own nest host.private final java.util.List<? extends TypeDescription> nestMembers
protected Default(java.lang.String name, int modifiers, TypeDescription.Generic superClass, java.util.List<? extends TypeVariableToken> typeVariables, java.util.List<? extends TypeDescription.Generic> interfaceTypes, java.util.List<? extends FieldDescription.Token> fieldTokens, java.util.List<? extends MethodDescription.Token> methodTokens, java.util.List<? extends AnnotationDescription> annotationDescriptions, TypeInitializer typeInitializer, LoadedTypeInitializer loadedTypeInitializer, TypeDescription declaringType, MethodDescription.InDefinedShape enclosingMethod, TypeDescription enclosingType, java.util.List<? extends TypeDescription> declaredTypes, boolean anonymousClass, boolean localClass, TypeDescription nestHost, java.util.List<? extends TypeDescription> nestMembers)
name
- The binary name of the instrumented type.modifiers
- The modifiers of the instrumented type.typeVariables
- The instrumented type's type variables in their tokenized form.superClass
- 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.anonymousClass
- true
if this type is a anonymous class.localClass
- true
if this type is a local class.nestHost
- The nest host of this instrumented type or a description of TargetType
if this type is its own nest host.nestMembers
- A list of all members of this types nest group excluding this type.public static InstrumentedType of(java.lang.String name, TypeDescription.Generic superClass, ModifierContributor.ForType... modifierContributor)
name
- The type's name.superClass
- The type's super class.modifierContributor
- The type's modifiers.public static InstrumentedType of(java.lang.String name, TypeDescription.Generic superClass, int modifiers)
name
- The type's name.superClass
- The type's super class.modifiers
- The type's modifiers.public InstrumentedType.WithFlexibleName withModifiers(int modifiers)
withModifiers
in interface InstrumentedType
withModifiers
in interface InstrumentedType.WithFlexibleName
modifiers
- The instrumented type's modifiers.public InstrumentedType.WithFlexibleName withField(FieldDescription.Token token)
withField
in interface InstrumentedType
withField
in interface InstrumentedType.WithFlexibleName
token
- A token that represents the field's shape. This token must represent types in their detached state.public InstrumentedType.WithFlexibleName withMethod(MethodDescription.Token token)
withMethod
in interface InstrumentedType
withMethod
in interface InstrumentedType.WithFlexibleName
token
- A token that represents the method's shape. This token must represent types in their detached state.public InstrumentedType.WithFlexibleName withInterfaces(TypeList.Generic interfaceTypes)
withInterfaces
in interface InstrumentedType
withInterfaces
in interface InstrumentedType.WithFlexibleName
interfaceTypes
- The interface types to implement.public InstrumentedType.WithFlexibleName withAnnotations(java.util.List<? extends AnnotationDescription> annotationDescriptions)
withAnnotations
in interface InstrumentedType
withAnnotations
in interface InstrumentedType.WithFlexibleName
annotationDescriptions
- The annotations to add to the instrumented type.public InstrumentedType.WithFlexibleName withNestHost(TypeDescription nestHost)
withNestHost
in interface InstrumentedType
withNestHost
in interface InstrumentedType.WithFlexibleName
nestHost
- The nest host of the created instrumented type.public InstrumentedType.WithFlexibleName withNestMembers(TypeList nestMembers)
withNestMembers
in interface InstrumentedType
withNestMembers
in interface InstrumentedType.WithFlexibleName
nestMembers
- The nest members to add to the created instrumented type.public InstrumentedType.WithFlexibleName withEnclosingType(TypeDescription enclosingType)
withEnclosingType
in interface InstrumentedType
withEnclosingType
in interface InstrumentedType.WithFlexibleName
enclosingType
- The type to define as the created instrumented type's enclosing type.public InstrumentedType.WithFlexibleName withEnclosingMethod(MethodDescription.InDefinedShape enclosingMethod)
withEnclosingMethod
in interface InstrumentedType
withEnclosingMethod
in interface InstrumentedType.WithFlexibleName
enclosingMethod
- The method to define as the created instrumented type's enclosing method.public InstrumentedType.WithFlexibleName withDeclaringType(TypeDescription declaringType)
withDeclaringType
in interface InstrumentedType
withDeclaringType
in interface InstrumentedType.WithFlexibleName
declaringType
- The type that declares the instrumented type.public InstrumentedType.WithFlexibleName withDeclaredTypes(TypeList declaredTypes)
withDeclaredTypes
in interface InstrumentedType
withDeclaredTypes
in interface InstrumentedType.WithFlexibleName
declaredTypes
- The types to add to the created instrumented type as declared types.public InstrumentedType.WithFlexibleName withTypeVariable(TypeVariableToken typeVariable)
withTypeVariable
in interface InstrumentedType
withTypeVariable
in interface InstrumentedType.WithFlexibleName
typeVariable
- The type variable to declare.public InstrumentedType.WithFlexibleName withName(java.lang.String name)
withName
in interface InstrumentedType.WithFlexibleName
name
- The name of the instrumented type.public InstrumentedType.WithFlexibleName withTypeVariables(ElementMatcher<? super TypeDescription.Generic> matcher, Transformer<TypeVariableToken> transformer)
withTypeVariables
in interface InstrumentedType.WithFlexibleName
matcher
- The matcher to decide what type variables to transform.transformer
- The transformer to apply on all matched type variables.public InstrumentedType.WithFlexibleName withLocalClass(boolean localClass)
withLocalClass
in interface InstrumentedType
withLocalClass
in interface InstrumentedType.WithFlexibleName
localClass
- true
if the instrumented type is supposed to be treated as a local class.public InstrumentedType.WithFlexibleName withAnonymousClass(boolean anonymousClass)
withAnonymousClass
in interface InstrumentedType
withAnonymousClass
in interface InstrumentedType.WithFlexibleName
anonymousClass
- true
if the instrumented type is supposed to be treated as an anonymous class.public InstrumentedType.WithFlexibleName withInitializer(LoadedTypeInitializer loadedTypeInitializer)
LoadedTypeInitializer
.withInitializer
in interface InstrumentedType
withInitializer
in interface InstrumentedType.WithFlexibleName
loadedTypeInitializer
- The type initializer to include.public InstrumentedType.WithFlexibleName withInitializer(ByteCodeAppender byteCodeAppender)
withInitializer
in interface InstrumentedType
withInitializer
in interface InstrumentedType.WithFlexibleName
byteCodeAppender
- The byte code to add to the type initializer.public LoadedTypeInitializer getLoadedTypeInitializer()
LoadedTypeInitializer
s that were registered
for this instrumented type.getLoadedTypeInitializer
in interface InstrumentedType
public TypeInitializer getTypeInitializer()
getTypeInitializer
in interface InstrumentedType
public MethodDescription.InDefinedShape getEnclosingMethod()
null
is returned by this method.getEnclosingMethod
in interface TypeDescription
null
if there is no such method.public TypeDescription getEnclosingType()
getEnclosingType
in interface TypeDescription
null
if there is no such type.public TypeList getDeclaredTypes()
getDeclaredTypes
in interface TypeDescription
public boolean isAnonymousType()
isAnonymousType
in interface TypeDescription
true
if this type description represents an anonymous type.public boolean isLocalType()
isLocalType
in interface TypeDescription
true
if this type description represents a local type.public PackageDescription getPackage()
null
if the described type does not imply a package.getPackage
in interface TypeDescription
null
if the described type does not imply a package.public AnnotationList getDeclaredAnnotations()
getDeclaredAnnotations
in interface AnnotationSource
public TypeDescription getDeclaringType()
getDeclaringType
in interface DeclaredByType
getDeclaringType
in interface TypeDescription
null
if no such type exists.public TypeDescription.Generic getSuperClass()
TypeDefinition.Sort.NON_GENERIC
),
parameterized types (TypeDefinition.Sort.PARAMETERIZED
) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY
) types. Interface types
and the Object
class do not define a super class where null
is returned. Array types define Object
as their direct super class.getSuperClass
in interface TypeDefinition
null
if no super class exists for this type.public TypeList.Generic getInterfaces()
TypeDefinition.Sort.NON_GENERIC
),
parameterized types (TypeDefinition.Sort.PARAMETERIZED
) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY
) types.getInterfaces
in interface TypeDefinition
public FieldList<FieldDescription.InDefinedShape> getDeclaredFields()
TypeDefinition.Sort.NON_GENERIC
),
parameterized types (TypeDefinition.Sort.PARAMETERIZED
) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY
) types. Generic array
types never define fields and the returned list is always empty for such types.getDeclaredFields
in interface TypeDefinition
getDeclaredFields
in interface TypeDescription
TypeDefinition.Sort.NON_GENERIC
),
parameterized types (TypeDefinition.Sort.PARAMETERIZED
) or generic array types (TypeDefinition.Sort.GENERIC_ARRAY
) types. Generic array
types never define methods and the returned list is always empty for such types.public MethodList<MethodDescription.InDefinedShape> getDeclaredMethods()
getDeclaredMethods
in interface TypeDefinition
getDeclaredMethods
in interface TypeDescription
public TypeList.Generic getTypeVariables()
getTypeVariables
in interface TypeVariableSource
public int getModifiers()
getModifiers
in interface ModifierReviewable
public java.lang.String getName()
getName
in interface NamedElement.WithRuntimeName
public TypeDescription getNestHost()
getNestHost
in interface TypeDescription
public TypeList getNestMembers()
getNestMembers
in interface TypeDescription
public TypeDescription validated()
validated
in interface InstrumentedType
private static boolean isValidIdentifier(java.lang.String[] identifier)
identifier
- an array of potentially invalid Java identifiers.true
if all identifiers are valid and the array is not empty.private static boolean isValidIdentifier(java.lang.String identifier)
identifier
- The identifier to check for validity.true
if the given identifier is valid.