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 Advice.PostProcessor.Factory
Advice.PostProcessor.Factory.Compound -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Advice.AssignReturned.ExceptionHandler.FactoryThe exception handler factory to use.private final List<? extends Advice.AssignReturned.Handler.Factory<?>> The handler factories to apply.private static final MethodDescription.InDefinedShapeA description of theAdvice.AssignReturned.AsScalar.skipOnDefaultValue()method. -
Constructor Summary
ConstructorsModifierConstructorDescriptionFactory()Creates a new factory which a preresolved list of handler factories.protectedFactory(List<? extends Advice.AssignReturned.Handler.Factory<?>> factories, Advice.AssignReturned.ExceptionHandler.Factory exceptionHandlerFactory) Creates a new factory. -
Method Summary
Modifier and TypeMethodDescriptionmake(List<? extends AnnotationDescription> annotations, TypeDescription returnType, 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.Factorythat 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.Factorythat includes the provided handlers.
-
with
Includes the provided handler factory.- Parameters:
factory- The handler factory to include.- Returns:
- new
Advice.AssignReturned.Factorythat includes the provided handler factory.
-
withSuppressed
Configures this post processor to handle exceptions during assignment with the advice'sAdvice.ExceptionHandler.- Parameters:
exceptionType- TheThrowabletype 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- TheThrowabletype to handle.- Returns:
- A new assigning post processor that handles the specified exception types.
-
make
public Advice.PostProcessor make(List<? extends AnnotationDescription> annotations, TypeDescription returnType, boolean exit) Creates a post processor for a given advice method.- Specified by:
makein interfaceAdvice.PostProcessor.Factory- Parameters:
annotations- The annotations of the advice method.returnType- The advice method's return type that is being post-processed.exit-trueif the advice is exit advice.- Returns:
- The created post processor.
-