Package net.bytebuddy.dynamic
Class DynamicType.Builder.AbstractBase.Adapter.OptionalMethodMatchAdapter
- java.lang.Object
-
- net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase<U>
-
- net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.Delegator<U>
-
- net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.Adapter.OptionalMethodMatchAdapter
-
- All Implemented Interfaces:
DynamicType.Builder<U>
,DynamicType.Builder.MethodDefinition.ImplementationDefinition<U>
,DynamicType.Builder.MethodDefinition.ImplementationDefinition.Optional<U>
- Enclosing class:
- DynamicType.Builder.AbstractBase.Adapter<U>
protected class DynamicType.Builder.AbstractBase.Adapter.OptionalMethodMatchAdapter extends DynamicType.Builder.AbstractBase.Delegator<U> implements DynamicType.Builder.MethodDefinition.ImplementationDefinition.Optional<U>
An adapter for optionally matching methods defined by declared interfaces.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase
DynamicType.Builder.AbstractBase.Adapter<U>, DynamicType.Builder.AbstractBase.Delegator<U>
-
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.DynamicType.Builder
DynamicType.Builder.AbstractBase<S>, DynamicType.Builder.FieldDefinition<S>, DynamicType.Builder.MethodDefinition<S>, DynamicType.Builder.TypeVariableDefinition<S>
-
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>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
OptionalMethodMatchAdapter(TypeList.Generic interfaces)
Creates a new optional method match adapter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<U>
defaultValue(AnnotationValue<?,?> annotationValue)
Defines the previously defined or matched method to return the supplied value as an annotation default value.<V> DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<U>
defaultValue(V value, java.lang.Class<? extends V> type)
Defines the previously defined or matched method to return the supplied value as an annotation default value.boolean
equals(java.lang.Object other)
int
hashCode()
DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<U>
intercept(Implementation implementation)
Implements the previously defined or matched method by the supplied implementation.protected DynamicType.Builder<U>
materialize()
Creates a new builder that realizes the current state of the builder.DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<U>
withoutCode()
Defines the previously defined or matched method to beabstract
.-
Methods inherited from class net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.Delegator
annotateType, attribute, defineConstructor, defineField, defineMethod, field, ignoreAlso, ignoreAlso, implement, initializer, initializer, invokable, make, make, make, make, merge, modifiers, name, transform, typeVariable, visit
-
Methods inherited from class net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase
annotateType, annotateType, annotateType, constructor, define, define, define, define, define, defineConstructor, defineConstructor, defineField, defineField, defineField, defineField, defineField, defineMethod, defineMethod, defineMethod, defineMethod, defineMethod, defineProperty, defineProperty, defineProperty, defineProperty, field, implement, implement, implement, invokable, merge, method, modifiers, modifiers, serialVersionUid, typeVariable, typeVariable, typeVariable, typeVariable
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.bytebuddy.dynamic.DynamicType.Builder
annotateType, annotateType, annotateType, annotateType, attribute, constructor, define, define, define, define, define, defineConstructor, defineConstructor, defineConstructor, defineField, defineField, defineField, defineField, defineField, defineField, defineMethod, defineMethod, defineMethod, defineMethod, defineMethod, defineMethod, defineProperty, defineProperty, defineProperty, defineProperty, field, field, ignoreAlso, ignoreAlso, implement, implement, implement, implement, initializer, initializer, invokable, invokable, make, make, make, make, merge, merge, method, modifiers, modifiers, modifiers, name, serialVersionUid, transform, typeVariable, typeVariable, typeVariable, typeVariable, typeVariable, visit
-
-
-
-
Constructor Detail
-
OptionalMethodMatchAdapter
protected OptionalMethodMatchAdapter(TypeList.Generic interfaces)
Creates a new optional method match adapter.- Parameters:
interfaces
- The interfaces whose methods are optionally matched.
-
-
Method Detail
-
materialize
protected DynamicType.Builder<U> materialize()
Description copied from class:DynamicType.Builder.AbstractBase.Delegator
Creates a new builder that realizes the current state of the builder.- Specified by:
materialize
in classDynamicType.Builder.AbstractBase.Delegator<U>
- Returns:
- A new builder that realizes the current state of the builder.
-
intercept
public DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<U> intercept(Implementation implementation)
Description copied from interface:DynamicType.Builder.MethodDefinition.ImplementationDefinition
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.
- Specified by:
intercept
in interfaceDynamicType.Builder.MethodDefinition.ImplementationDefinition<U>
- 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
public DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<U> withoutCode()
Description copied from interface:DynamicType.Builder.MethodDefinition.ImplementationDefinition
Defines the previously defined or matched method to beabstract
.- Specified by:
withoutCode
in interfaceDynamicType.Builder.MethodDefinition.ImplementationDefinition<U>
- Returns:
- A new builder where the previously defined or matched method is implemented to be abstract.
-
defaultValue
public DynamicType.Builder.MethodDefinition.ReceiverTypeDefinition<U> defaultValue(AnnotationValue<?,?> annotationValue)
Description copied from interface:DynamicType.Builder.MethodDefinition.ImplementationDefinition
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.- Specified by:
defaultValue
in interfaceDynamicType.Builder.MethodDefinition.ImplementationDefinition<U>
- 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<U> defaultValue(V value, java.lang.Class<? extends V> type)
Description copied from interface:DynamicType.Builder.MethodDefinition.ImplementationDefinition
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<U>
- 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.
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-