Class FieldDescription.AbstractBase
- java.lang.Object
-
- net.bytebuddy.description.ModifierReviewable.AbstractBase
-
- net.bytebuddy.description.field.FieldDescription.AbstractBase
-
- All Implemented Interfaces:
AnnotationSource,ByteCodeElement,ByteCodeElement.Member,ByteCodeElement.TypeDependant<FieldDescription.InDefinedShape,FieldDescription.Token>,DeclaredByType,DeclaredByType.WithMandatoryDeclaration,FieldDescription,ModifierReviewable,ModifierReviewable.ForFieldDescription,ModifierReviewable.ForMethodDescription,ModifierReviewable.ForModuleDescription,ModifierReviewable.ForModuleRequirement,ModifierReviewable.ForParameterDescription,ModifierReviewable.ForTypeDefinition,ModifierReviewable.OfAbstraction,ModifierReviewable.OfByteCodeElement,ModifierReviewable.OfEnumeration,ModifierReviewable.OfMandatable,NamedElement,NamedElement.WithDescriptor,NamedElement.WithGenericName,NamedElement.WithRuntimeName
- Direct Known Subclasses:
FieldDescription.InDefinedShape.AbstractBase,FieldDescription.TypeSubstituting,Transformer.ForField.TransformedField
- Enclosing interface:
- FieldDescription
public abstract static class FieldDescription.AbstractBase extends ModifierReviewable.AbstractBase implements FieldDescription
An abstract base implementation of a field description.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.annotation.AnnotationSource
AnnotationSource.Empty, AnnotationSource.Explicit
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.ByteCodeElement
ByteCodeElement.Member, ByteCodeElement.TypeDependant<T extends ByteCodeElement.TypeDependant<?,S>,S extends ByteCodeElement.Token<S>>
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.DeclaredByType
DeclaredByType.WithMandatoryDeclaration
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.field.FieldDescription
FieldDescription.AbstractBase, FieldDescription.ForLoadedField, FieldDescription.InDefinedShape, FieldDescription.InGenericShape, FieldDescription.Latent, FieldDescription.SignatureToken, FieldDescription.Token, FieldDescription.TypeSubstituting
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.ModifierReviewable
ModifierReviewable.AbstractBase, ModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForModuleDescription, ModifierReviewable.ForModuleRequirement, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumeration, ModifierReviewable.OfMandatable
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.NamedElement
NamedElement.WithDescriptor, NamedElement.WithGenericName, NamedElement.WithOptionalName, NamedElement.WithRuntimeName
-
-
Field Summary
-
Fields inherited from interface net.bytebuddy.description.field.FieldDescription
NO_DEFAULT_VALUE
-
Fields inherited from interface net.bytebuddy.description.ModifierReviewable
EMPTY_MASK
-
Fields inherited from interface net.bytebuddy.description.NamedElement
EMPTY_NAME, NO_NAME
-
Fields inherited from interface net.bytebuddy.description.NamedElement.WithDescriptor
NON_GENERIC_SIGNATURE
-
-
Constructor Summary
Constructors Constructor Description AbstractBase()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FieldDescription.SignatureTokenasSignatureToken()Returns a signature token representing this field.FieldDescription.TokenasToken(ElementMatcher<? super TypeDescription> matcher)Returns a token representative of this type dependant.booleanequals(java.lang.Object other)intgetActualModifiers()Returns the field's actual modifiers as it is present in a class file, i.e.java.lang.StringgetActualName()Returns the display name of this element as it is found in the source code.java.lang.StringgetDescriptor()Returns the descriptor of this byte code element.java.lang.StringgetGenericSignature()Returns the generic signature of this byte code element.java.lang.StringgetInternalName()Returns the internal name of this byte code element.inthashCode()booleanisAccessibleTo(TypeDescription typeDescription)Checks if this element is accessible from a given type.booleanisVisibleTo(TypeDescription typeDescription)Checks if this element is visible from a given type.java.lang.StringtoGenericString()Returns a generic string of this byte code element.java.lang.StringtoString()-
Methods inherited from class net.bytebuddy.description.ModifierReviewable.AbstractBase
getEnumerationState, getFieldManifestation, getFieldPersistence, getMandate, getMethodManifestation, getMethodStrictness, getOpenness, getOwnership, getParameterManifestation, getProvisioningState, getRequiredPhase, getSynchronizationState, getSyntheticState, getTransitivity, getTypeManifestation, getVisibility, isAbstract, isAnnotation, isBridge, isDeprecated, isEnum, isFinal, isInterface, isMandated, isNative, isOpen, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic, isStaticPhase, isStrict, isSynchronized, isSynthetic, isTransient, isTransitive, isVarArgs, isVolatile
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.bytebuddy.description.annotation.AnnotationSource
getDeclaredAnnotations
-
Methods inherited from interface net.bytebuddy.description.ByteCodeElement.TypeDependant
asDefined
-
Methods inherited from interface net.bytebuddy.description.field.FieldDescription
getDeclaringType, getType
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable
getModifiers, getSyntheticState, isFinal, isSynthetic
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable.ForFieldDescription
getFieldManifestation, getFieldPersistence, isTransient, isVolatile
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable.OfByteCodeElement
getOwnership, getVisibility, isDeprecated, isPackagePrivate, isPrivate, isProtected, isPublic, isStatic
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable.OfEnumeration
getEnumerationState, isEnum
-
Methods inherited from interface net.bytebuddy.description.NamedElement.WithRuntimeName
getName
-
-
-
-
Method Detail
-
getInternalName
public java.lang.String getInternalName()
Returns the internal name of this byte code element. If no well-defined internal name is known for this element, the actual name is returned.- Specified by:
getInternalNamein interfaceNamedElement.WithRuntimeName- Returns:
- The internal name of this byte code element as used within the Java class file format.
-
getActualName
public java.lang.String getActualName()
Returns the display name of this element as it is found in the source code. If no such name exists, an empty string is returned.- Specified by:
getActualNamein interfaceNamedElement- Returns:
- The name of this element as given in a Java program's source code.
-
getDescriptor
public java.lang.String getDescriptor()
Returns the descriptor of this byte code element.- Specified by:
getDescriptorin interfaceNamedElement.WithDescriptor- Returns:
- The descriptor of this byte code element.
-
getGenericSignature
@MaybeNull public java.lang.String getGenericSignature()
Returns the generic signature of this byte code element. If this element does not reference generic types or references malformed generic types,nullis returned as a signature.- Specified by:
getGenericSignaturein interfaceNamedElement.WithDescriptor- Returns:
- The generic signature or
nullif this element is not generic.
-
isVisibleTo
public boolean isVisibleTo(TypeDescription typeDescription)
Checks if this element is visible from a given type. Visibility is a wider criteria then accessibility which can be checked by
ByteCodeElement.isAccessibleTo(TypeDescription). Visibility allows the invocation of a method on itself or on external instances.Note: A method or field might define a signature that includes types that are not visible to a type. Such methods can be legally invoked from this type and can even be implemented as bridge methods by this type. It is however not legal to declare a method with invisible types in its signature that are not bridges what might require additional validation.
Important: Virtual byte code elements, i.e. virtual methods, are only considered visible if the type they are invoked upon is visible to a given type. The visibility of such virtual members can therefore not be determined by only investigating the invoked method but requires an additional check of the target type.
- Specified by:
isVisibleToin interfaceByteCodeElement- Parameters:
typeDescription- The type which is checked for its visibility of this element.- Returns:
trueif this element is visible fortypeDescription.
-
isAccessibleTo
public boolean isAccessibleTo(TypeDescription typeDescription)
Checks if this element is accessible from a given type. Accessibility is a more narrow criteria then visibility which can be checked by
ByteCodeElement.isVisibleTo(TypeDescription). Accessibility allows the invocation of a method on external instances or on itself. Methods that can be invoked from within an instance might however not be considered accessible.Note: A method or field might define a signature that includes types that are not visible to a type. Such methods can be legally invoked from this type and can even be implemented as bridge methods by this type. It is however not legal to declare a method with invisible types in its signature that are not bridges what might require additional validation.
Important: Virtual byte code elements, i.e. virtual methods, are only considered visible if the type they are invoked upon is visible to a given type. The visibility of such virtual members can therefore not be determined by only investigating the invoked method but requires an additional check of the target type.
- Specified by:
isAccessibleToin interfaceByteCodeElement- Parameters:
typeDescription- The type which is checked for its accessibility of this element.- Returns:
trueif this element is accessible fortypeDescription.
-
getActualModifiers
public int getActualModifiers()
Returns the field's actual modifiers as it is present in a class file, i.e. its modifiers including a flag if this field is deprecated.- Specified by:
getActualModifiersin interfaceFieldDescription- Returns:
- The field's actual modifiers.
-
asToken
public FieldDescription.Token asToken(ElementMatcher<? super TypeDescription> matcher)
Returns a token representative of this type dependant. All types that are matched by the supplied matcher are replaced byTargetTypedescriptions.- Specified by:
asTokenin interfaceByteCodeElement.TypeDependant<FieldDescription.InDefinedShape,FieldDescription.Token>- Parameters:
matcher- A matcher to identify types to be replaced byTargetTypedescriptions.- Returns:
- A token representative of this type dependant.
-
asSignatureToken
public FieldDescription.SignatureToken asSignatureToken()
Returns a signature token representing this field.- Specified by:
asSignatureTokenin interfaceFieldDescription- Returns:
- A signature token representing this field.
-
hashCode
@Enhance("hashCode") public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(@MaybeNull java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
toGenericString
public java.lang.String toGenericString()
Returns a generic string of this byte code element.- Specified by:
toGenericStringin interfaceNamedElement.WithGenericName- Returns:
- A generic string of this byte code element.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-