Package net.bytebuddy.dynamic
Class DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable.AbstractBase.Adapter<X>
java.lang.Object
net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.ImplementationDefinition.AbstractBase<V>
net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.TypeVariableDefinition.AbstractBase<W>
net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable.AbstractBase<X>
net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable.AbstractBase.Adapter<X>
- Type Parameters:
X
- A loaded type that the built type is guaranteed to be a subclass of.
- All Implemented Interfaces:
DynamicType.Builder.MethodDefinition.ImplementationDefinition<X>
,DynamicType.Builder.MethodDefinition.TypeVariableDefinition<X>
,DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable<X>
- Direct Known Subclasses:
DynamicType.Builder.AbstractBase.Adapter.MethodDefinitionAdapter.TypeVariableAnnotationAdapter
- Enclosing class:
- DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable.AbstractBase<W>
protected abstract static class DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable.AbstractBase.Adapter<X>
extends DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable.AbstractBase<X>
An adapter implementation for an annotatable type variable definition.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable.AbstractBase
DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable.AbstractBase.Adapter<X>
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.ImplementationDefinition
DynamicType.Builder.MethodDefinition.ImplementationDefinition.AbstractBase<V>, DynamicType.Builder.MethodDefinition.ImplementationDefinition.Optional<V>
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.TypeVariableDefinition
DynamicType.Builder.MethodDefinition.TypeVariableDefinition.AbstractBase<V>, DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable<V>
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable
DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable.AbstractBase<W>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondefaultValue
(AnnotationValue<?, ?> annotationValue) Defines the previously defined or matched method to return the supplied value as an annotation default value.defaultValue
(V value, Class<? extends V> type) Defines the previously defined or matched method to return the supplied value as an annotation default value.intercept
(Implementation implementation) Implements the previously defined or matched method by the supplied implementation.protected abstract DynamicType.Builder.MethodDefinition.ParameterDefinition<X>
Materializes this instance as a parameter definition with the currently defined properties.typeVariable
(String symbol, Collection<? extends TypeDefinition> bounds) Defines a method variable to be declared by the currently defined method.Defines the previously defined or matched method not to declare a method body.Methods inherited from class net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable.AbstractBase
annotateTypeVariable, annotateTypeVariable, annotateTypeVariable
Methods inherited from class net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.TypeVariableDefinition.AbstractBase
typeVariable, typeVariable, typeVariable, typeVariable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.TypeVariableDefinition
typeVariable, typeVariable, typeVariable, typeVariable
Methods inherited from interface net.bytebuddy.dynamic.DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable
annotateTypeVariable
-
Constructor Details
-
Adapter
protected Adapter()
-
-
Method Details
-
typeVariable
public DynamicType.Builder.MethodDefinition.TypeVariableDefinition.Annotatable<X> typeVariable(String symbol, Collection<? extends TypeDefinition> bounds) Defines a method variable to be declared by the currently defined method.- Parameters:
symbol
- The symbol of the type variable.bounds
- The bounds of the type variables. Can also beTargetType
for any type if a bound type should be equal to the currently instrumented type.- Returns:
- A new builder that is equal to the current builder but where the currently defined method declares the specified type variable.
-
intercept
public DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<X> intercept(Implementation implementation) Implements the previously defined or matched method by the supplied implementation. A method interception is typically implemented in one of the following ways:- If a method is declared by the instrumented type and the type builder creates a subclass or redefinition, any preexisting method is replaced by the given implementation. Any previously defined implementation is lost.
- If a method is declared by the instrumented type and the type builder creates a rebased version of the instrumented type, the original method is preserved within a private, synthetic method within the instrumented type. The original method therefore remains invokeable and is treated as the direct super method of the new method. When rebasing a type, it therefore becomes possible to invoke a non-virtual method's super method when a preexisting method body is replaced.
- If a virtual method is inherited from a super type, it is overridden. The overridden method is available for super method invocation.
- Parameters:
implementation
- The implementation for implementing the previously defined or matched method.- Returns:
- A new builder where the previously defined or matched method is implemented by the supplied implementation.
-
withoutCode
Defines the previously defined or matched method not to declare a method body. This implies the method to beabstract
unless it was already declared to benative
.- Returns:
- A new builder where the previously defined or matched method is implemented to be abstract.
-
defaultValue
public DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<X> defaultValue(AnnotationValue<?, ?> annotationValue) Defines the previously defined or matched method to return the supplied value as an annotation default value. The value must be supplied in its unloaded state, i.e. enumerations asEnumerationDescription
, types asTypeDescription
and annotations asAnnotationDescription
. For supplying loaded types, useDynamicType.Builder.MethodDefinition.ImplementationDefinition.defaultValue(Object, Class)
must be used.- Parameters:
annotationValue
- The value to be defined as a default value.- Returns:
- A builder where the previously defined or matched method is implemented to return an annotation default value.
-
defaultValue
public <V> DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<X> defaultValue(V value, Class<? extends V> type) Defines the previously defined or matched method to return the supplied value as an annotation default value. The value must be supplied in its loaded state paired with the property type of the value.- Specified by:
defaultValue
in interfaceDynamicType.Builder.MethodDefinition.ImplementationDefinition<X>
- Overrides:
defaultValue
in classDynamicType.Builder.MethodDefinition.ImplementationDefinition.AbstractBase<X>
- Type Parameters:
V
- The type of the annotation property.- Parameters:
value
- The value to be defined as a default value.type
- The type of the annotation property.- Returns:
- A builder where the previously defined or matched method is implemented to return an annotation default value.
-
materialize
Materializes this instance as a parameter definition with the currently defined properties.- Returns:
- A parameter definition with the currently defined properties.
-