Package net.bytebuddy.agent.builder
Class AgentBuilder.RedefinitionStrategy.Listener.StreamWriting
- java.lang.Object
-
- net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener.StreamWriting
-
- All Implemented Interfaces:
AgentBuilder.RedefinitionStrategy.Listener
- Enclosing interface:
- AgentBuilder.RedefinitionStrategy.Listener
@Enhance public static class AgentBuilder.RedefinitionStrategy.Listener.StreamWriting extends java.lang.Object implements AgentBuilder.RedefinitionStrategy.Listener
A listener that writes events to aPrintStream.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.agent.builder.AgentBuilder.RedefinitionStrategy.Listener
AgentBuilder.RedefinitionStrategy.Listener.Adapter, AgentBuilder.RedefinitionStrategy.Listener.BatchReallocator, AgentBuilder.RedefinitionStrategy.Listener.Compound, AgentBuilder.RedefinitionStrategy.Listener.ErrorEscalating, AgentBuilder.RedefinitionStrategy.Listener.NoOp, AgentBuilder.RedefinitionStrategy.Listener.Pausing, AgentBuilder.RedefinitionStrategy.Listener.StreamWriting, AgentBuilder.RedefinitionStrategy.Listener.Yielding
-
-
Field Summary
Fields Modifier and Type Field Description private java.io.PrintStreamprintStreamThe print stream to write any events to.
-
Constructor Summary
Constructors Constructor Description StreamWriting(java.io.PrintStream printStream)Creates a new stream writing listener.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonBatch(int index, java.util.List<java.lang.Class<?>> batch, java.util.List<java.lang.Class<?>> types)Invoked before applying a batch.voidonComplete(int amount, java.util.List<java.lang.Class<?>> types, java.util.Map<java.util.List<java.lang.Class<?>>,java.lang.Throwable> failures)Invoked upon completion of all batches.java.lang.Iterable<? extends java.util.List<java.lang.Class<?>>>onError(int index, java.util.List<java.lang.Class<?>> batch, java.lang.Throwable throwable, java.util.List<java.lang.Class<?>> types)Invoked upon an error during a batch.static AgentBuilder.RedefinitionStrategy.ListenertoSystemError()Writes the stream result toSystem.err.static AgentBuilder.RedefinitionStrategy.ListenertoSystemOut()Writes the stream result toSystem.out.
-
-
-
Method Detail
-
toSystemOut
public static AgentBuilder.RedefinitionStrategy.Listener toSystemOut()
Writes the stream result toSystem.out.- Returns:
- An appropriate listener.
-
toSystemError
public static AgentBuilder.RedefinitionStrategy.Listener toSystemError()
Writes the stream result toSystem.err.- Returns:
- An appropriate listener.
-
onBatch
public void onBatch(int index, java.util.List<java.lang.Class<?>> batch, java.util.List<java.lang.Class<?>> types)Invoked before applying a batch.- Specified by:
onBatchin interfaceAgentBuilder.RedefinitionStrategy.Listener- Parameters:
index- A running index of the batch starting at0.batch- The types included in this batch.types- All types included in the redefinition.
-
onError
public java.lang.Iterable<? extends java.util.List<java.lang.Class<?>>> onError(int index, java.util.List<java.lang.Class<?>> batch, java.lang.Throwable throwable, java.util.List<java.lang.Class<?>> types)Invoked upon an error during a batch. This method is not invoked if the failure handler handled this error.- Specified by:
onErrorin interfaceAgentBuilder.RedefinitionStrategy.Listener- Parameters:
index- A running index of the batch starting at0.batch- The types included in this batch.throwable- The throwable that caused this invocation.types- All types included in the redefinition.- Returns:
- A set of classes which should be attempted to be redefined. Typically, this should be a subset of the classes
contained in
batchbut not all classes.
-
onComplete
public void onComplete(int amount, java.util.List<java.lang.Class<?>> types, java.util.Map<java.util.List<java.lang.Class<?>>,java.lang.Throwable> failures)Invoked upon completion of all batches.- Specified by:
onCompletein interfaceAgentBuilder.RedefinitionStrategy.Listener- Parameters:
amount- The total amount of batches that were executed.types- All types included in the redefinition.failures- A mapping of batch types to their unhandled failures.
-
-