Interface ByteCodeElement
-
- All Superinterfaces:
AnnotationSource
,DeclaredByType
,ModifierReviewable
,NamedElement
,NamedElement.WithRuntimeName
- All Known Subinterfaces:
FieldDescription
,FieldDescription.InDefinedShape
,FieldDescription.InGenericShape
,InstrumentedType
,InstrumentedType.WithFlexibleName
,MethodDescription
,MethodDescription.InDefinedShape
,MethodDescription.InGenericShape
,TypeDescription
- All Known Implementing Classes:
FieldDescription.AbstractBase
,FieldDescription.ForLoadedField
,FieldDescription.InDefinedShape.AbstractBase
,FieldDescription.Latent
,FieldDescription.TypeSubstituting
,Implementation.Context.Default.AbstractPropertyAccessorMethod
,Implementation.Context.Default.AccessorMethod
,Implementation.Context.Default.CacheValueField
,Implementation.Context.Default.FieldGetter
,Implementation.Context.Default.FieldSetter
,InstrumentedType.Default
,InstrumentedType.Frozen
,MethodDescription.AbstractBase
,MethodDescription.ForLoadedConstructor
,MethodDescription.ForLoadedMethod
,MethodDescription.InDefinedShape.AbstractBase
,MethodDescription.Latent
,MethodDescription.Latent.TypeInitializer
,MethodDescription.TypeSubstituting
,MethodRebaseResolver.Resolution.ForRebasedConstructor.RebasedConstructor
,MethodRebaseResolver.Resolution.ForRebasedMethod.RebasedMethod
,Transformer.ForField.TransformedField
,Transformer.ForMethod.TransformedMethod
,TypeDescription.AbstractBase
,TypeDescription.AbstractBase.OfSimpleType
,TypeDescription.AbstractBase.OfSimpleType.WithDelegation
,TypeDescription.ArrayProjection
,TypeDescription.ForLoadedType
,TypeDescription.ForPackageDescription
,TypeDescription.Latent
,TypeDescription.SuperTypeLoading
,TypePool.Default.LazyTypeDescription
,TypePool.Default.WithLazyResolution.LazyTypeDescription
,TypePool.LazyFacade.LazyTypeDescription
,TypeWriter.MethodPool.Record.AccessBridgeWrapper.AccessorBridge
,TypeWriter.MethodPool.Record.AccessBridgeWrapper.BridgeTarget
,TypeWriter.MethodPool.Record.ForDefinedMethod.OfVisibilityBridge.VisibilityBridge
public interface ByteCodeElement extends NamedElement.WithRuntimeName, ModifierReviewable, DeclaredByType, AnnotationSource
Implementations describe an element represented in byte code, i.e. a type, a field or a method or a constructor.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ByteCodeElement.Token<T extends ByteCodeElement.Token<T>>
A token representing a byte code element.static interface
ByteCodeElement.TypeDependant<T extends ByteCodeElement.TypeDependant<?,S>,S extends ByteCodeElement.Token<S>>
A type dependant describes an element that is an extension of a type definition, i.e.-
Nested classes/interfaces inherited from interface net.bytebuddy.description.annotation.AnnotationSource
AnnotationSource.Empty, AnnotationSource.Explicit
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.ModifierReviewable
ModifierReviewable.AbstractBase, ModifierReviewable.ForFieldDescription, ModifierReviewable.ForMethodDescription, ModifierReviewable.ForParameterDescription, ModifierReviewable.ForTypeDefinition, ModifierReviewable.OfAbstraction, ModifierReviewable.OfByteCodeElement, ModifierReviewable.OfEnumeration
-
Nested classes/interfaces inherited from interface net.bytebuddy.description.NamedElement
NamedElement.WithGenericName, NamedElement.WithOptionalName, NamedElement.WithRuntimeName
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NON_GENERIC_SIGNATURE
The generic type signature of a non-generic byte code element.-
Fields inherited from interface net.bytebuddy.description.ModifierReviewable
EMPTY_MASK
-
Fields inherited from interface net.bytebuddy.description.NamedElement
EMPTY_NAME, NO_NAME
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
getDescriptor()
Returns the descriptor of this byte code element.java.lang.String
getGenericSignature()
Returns the generic signature of this byte code element.boolean
isAccessibleTo(TypeDescription typeDescription)
Checks if this element is accessible from a given type.boolean
isVisibleTo(TypeDescription typeDescription)
Checks if this element is visible from a given type.-
Methods inherited from interface net.bytebuddy.description.annotation.AnnotationSource
getDeclaredAnnotations
-
Methods inherited from interface net.bytebuddy.description.DeclaredByType
getDeclaringType
-
Methods inherited from interface net.bytebuddy.description.ModifierReviewable
getModifiers, getSyntheticState, isFinal, isSynthetic
-
Methods inherited from interface net.bytebuddy.description.NamedElement
getActualName
-
Methods inherited from interface net.bytebuddy.description.NamedElement.WithRuntimeName
getInternalName, getName
-
-
-
-
Method Detail
-
getDescriptor
java.lang.String getDescriptor()
Returns the descriptor of this byte code element.- Returns:
- The descriptor of this byte code element.
-
getGenericSignature
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,null
is returned as a signature.- Returns:
- The generic signature or
null
if this element is not generic.
-
isVisibleTo
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
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.
- Parameters:
typeDescription
- The type which is checked for its visibility of this element.- Returns:
true
if this element is visible fortypeDescription
.
-
isAccessibleTo
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
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.
- Parameters:
typeDescription
- The type which is checked for its accessibility of this element.- Returns:
true
if this element is accessible fortypeDescription
.
-
-