Package net.bytebuddy.asm
Class Advice.AssignReturned.Factory
java.lang.Object
net.bytebuddy.asm.Advice.AssignReturned.Factory
- All Implemented Interfaces:
Advice.PostProcessor.Factory
- Enclosing class:
Advice.AssignReturned
@Enhance
public static class Advice.AssignReturned.Factory
extends Object
implements Advice.PostProcessor.Factory
A factory to create a
Advice.AssignReturned
post processor. This processor is only added if the advice
method does not return void
.-
Nested Class Summary
Nested classes/interfaces inherited from interface net.bytebuddy.asm.Advice.PostProcessor.Factory
Advice.PostProcessor.Factory.Compound
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Advice.AssignReturned.ExceptionHandler.Factory
The exception handler factory to use.private final List
<? extends Advice.AssignReturned.Handler.Factory<?>> The handler factories to apply.private static final MethodDescription.InDefinedShape
A description of theAdvice.AssignReturned.AsScalar.skipOnDefaultValue()
method. -
Constructor Summary
ConstructorsModifierConstructorDescriptionFactory()
Creates a new factory which a preresolved list of handler factories.protected
Factory
(List<? extends Advice.AssignReturned.Handler.Factory<?>> factories, Advice.AssignReturned.ExceptionHandler.Factory exceptionHandlerFactory) Creates a new factory. -
Method Summary
Modifier and TypeMethodDescriptionmake
(MethodDescription.InDefinedShape advice, boolean exit) Creates a post processor for a given advice method.with
(Class<? extends Annotation> type, List<Advice.AssignReturned.Handler> handlers) Includes a list of handlers upon discovering an annotation of a given type.with
(Class<? extends Annotation> type, Advice.AssignReturned.Handler... handler) Includes a list of handlers upon discovering an annotation of a given type.with
(Advice.AssignReturned.Handler.Factory<?> factory) Includes the provided handler factory.withSuppressed
(Class<? extends Throwable> exceptionType) Configures this post processor to handle exceptions during assignment with the advice'sAdvice.ExceptionHandler
.withSuppressed
(TypeDescription exceptionType) Configures this post processor to handle exceptions during assignment with the advice'sAdvice.ExceptionHandler
.
-
Field Details
-
SKIP_ON_DEFAULT_VALUE
A description of theAdvice.AssignReturned.AsScalar.skipOnDefaultValue()
method. -
factories
The handler factories to apply. -
exceptionHandlerFactory
The exception handler factory to use.
-
-
Constructor Details
-
Factory
public Factory()Creates a new factory which a preresolved list of handler factories. -
Factory
protected Factory(List<? extends Advice.AssignReturned.Handler.Factory<?>> factories, Advice.AssignReturned.ExceptionHandler.Factory exceptionHandlerFactory) Creates a new factory.- Parameters:
factories
- The handler factories to apply.exceptionHandlerFactory
- The exception handler factory to use.
-
-
Method Details
-
with
public Advice.AssignReturned.Factory with(Class<? extends Annotation> type, Advice.AssignReturned.Handler... handler) Includes a list of handlers upon discovering an annotation of a given type.- Parameters:
type
- The annotation type that activates the handler factory.handler
- The handlers to use upon discovery.- Returns:
- A new
Advice.AssignReturned.Factory
that includes the provided handlers.
-
with
public Advice.AssignReturned.Factory with(Class<? extends Annotation> type, List<Advice.AssignReturned.Handler> handlers) Includes a list of handlers upon discovering an annotation of a given type.- Parameters:
type
- The annotation type that activates the handler factory.handlers
- The handlers to use upon discovery.- Returns:
- A new
Advice.AssignReturned.Factory
that includes the provided handlers.
-
with
Includes the provided handler factory.- Parameters:
factory
- The handler factory to include.- Returns:
- new
Advice.AssignReturned.Factory
that includes the provided handler factory.
-
withSuppressed
Configures this post processor to handle exceptions during assignment with the advice'sAdvice.ExceptionHandler
.- Parameters:
exceptionType
- TheThrowable
type to handle.- Returns:
- A new assigning post processor that handles the specified exception types.
-
withSuppressed
Configures this post processor to handle exceptions during assignment with the advice'sAdvice.ExceptionHandler
.- Parameters:
exceptionType
- TheThrowable
type to handle.- Returns:
- A new assigning post processor that handles the specified exception types.
-
make
Creates a post processor for a given advice method.- Specified by:
make
in interfaceAdvice.PostProcessor.Factory
- Parameters:
advice
- The advice method to create the post processor for.exit
-true
if the advice is exit advice.- Returns:
- The created post processor.
-