Interface Descriptor
-
- All Known Implementing Classes:
ArrayType
,ClassInfo
,ClassType
,FieldInfo
,MethodInfo
,ParameterizedType
,PrimitiveType
,RecordComponentInfo
,Type
,TypeVariable
,TypeVariableReference
,UnresolvedTypeVariable
,VoidType
,WildcardType
public interface Descriptor
Implementations of this interface have a bytecode descriptor, as defined in JVMS 17, chapter 4.3.
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.function.Function<java.lang.String,Type>
NO_SUBSTITUTION
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.String
descriptor()
Returns a bytecode descriptor of this element.java.lang.String
descriptor(java.util.function.Function<java.lang.String,Type> typeVariableSubstitution)
Returns a bytecode descriptor of this element.static void
forType(Type type, java.util.function.Function<java.lang.String,Type> typeVariableSubstitution, java.lang.StringBuilder result)
Appends a bytecode descriptor of a single type to givenStringBuilder
.
-
-
-
Field Detail
-
NO_SUBSTITUTION
static final java.util.function.Function<java.lang.String,Type> NO_SUBSTITUTION
-
-
Method Detail
-
descriptor
default java.lang.String descriptor()
Returns a bytecode descriptor of this element.Note that the return value does not come directly from bytecode. Jandex does not store the descriptor strings. Instead, the return value is reconstructed from the Jandex object model.
- Returns:
- a bytecode descriptor of this declaration, never
null
-
descriptor
java.lang.String descriptor(java.util.function.Function<java.lang.String,Type> typeVariableSubstitution)
Returns a bytecode descriptor of this element.Descriptors of type variables are substituted for descriptors of types provided by the substitution function
typeVariableSubstitution
. If the substitution function returnsnull
for some type variable identifier, or if it returns the type variable itself, no substitution happens and the type variable descriptor is used unmodified.Note that the return value does not come directly from bytecode. Jandex does not store the descriptor strings. Instead, the return value is reconstructed from the Jandex object model.
- Parameters:
typeVariableSubstitution
- a substitution function from type variable identifiers to types- Returns:
- a bytecode descriptor of this declaration, never
null
-
forType
static void forType(Type type, java.util.function.Function<java.lang.String,Type> typeVariableSubstitution, java.lang.StringBuilder result)
Appends a bytecode descriptor of a single type to givenStringBuilder
.Descriptors of type variables are substituted for descriptors of types provided by the substitution function
typeVariableSubstitution
. If the substitution function returnsnull
for some type variable identifier, or if it returns the type variable itself, no substitution happens and the type variable descriptor is used unmodified.- Parameters:
type
- a type whose bytecode descriptor is appended toresult
typeVariableSubstitution
- a substitution function from type variable identifiers to typesresult
- theStringBuilder
to which the bytecode descriptor is appended
-
-