Package net.bytebuddy.build
Class Plugin.Engine.Listener.StreamWriting
- java.lang.Object
-
- net.bytebuddy.build.Plugin.Engine.Listener.Adapter
-
- net.bytebuddy.build.Plugin.Engine.Listener.StreamWriting
-
- All Implemented Interfaces:
Plugin.Engine.ErrorHandler
,Plugin.Engine.Listener
- Enclosing interface:
- Plugin.Engine.Listener
@Enhance public static class Plugin.Engine.Listener.StreamWriting extends Plugin.Engine.Listener.Adapter
A listener that forwards significant events of a plugin engine application to aPrintStream
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.bytebuddy.build.Plugin.Engine.ErrorHandler
Plugin.Engine.ErrorHandler.Enforcing, Plugin.Engine.ErrorHandler.Failing
-
Nested classes/interfaces inherited from interface net.bytebuddy.build.Plugin.Engine.Listener
Plugin.Engine.Listener.Adapter, Plugin.Engine.Listener.Compound, Plugin.Engine.Listener.ForErrorHandler, Plugin.Engine.Listener.NoOp, Plugin.Engine.Listener.StreamWriting, Plugin.Engine.Listener.WithErrorsOnly, Plugin.Engine.Listener.WithTransformationsOnly
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
PREFIX
The prefix that is appended to all written messages.private java.io.PrintStream
printStream
The print stream to delegate 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 void
onComplete(TypeDescription typeDescription)
Invoked upon completing handling a type that was either transformed or ignored.void
onDiscovery(java.lang.String typeName)
Invoked upon discovering a type but prior to its resolution.void
onError(Plugin plugin, java.lang.Throwable throwable)
Invoked at the end of the build if a plugin could not be closed.void
onError(TypeDescription typeDescription, Plugin plugin, java.lang.Throwable throwable)
Invoked if an error occured during a plugin's application on a given type.void
onIgnored(TypeDescription typeDescription, Plugin plugin)
Invoked if a type description is ignored by a given plugin.void
onLiveInitializer(TypeDescription typeDescription, TypeDescription definingType)
Invoked if a type transformation implied a live initializer.void
onManifest(java.util.jar.Manifest manifest)
Invoked when a manifest was found or found missing.void
onResource(java.lang.String name)
Invoked if a resource that is not a class file is discovered.void
onTransformation(TypeDescription typeDescription, Plugin plugin)
Invoked after a type was transformed using a specific plugin.void
onUnresolved(java.lang.String typeName)
Invoked if a type could not be resolved.static Plugin.Engine.Listener.StreamWriting
toSystemError()
Creates a stream writing listener that prints all events onSystem.err
.static Plugin.Engine.Listener.StreamWriting
toSystemOut()
Creates a stream writing listener that prints all events onSystem.out
.Plugin.Engine.Listener
withErrorsOnly()
Returns a new listener that only prints error events.Plugin.Engine.Listener
withTransformationsOnly()
Returns a new listener that only prints transformation and error events.-
Methods inherited from class net.bytebuddy.build.Plugin.Engine.Listener.Adapter
onError, onError, onIgnored, onTransformation
-
-
-
-
Field Detail
-
PREFIX
protected static final java.lang.String PREFIX
The prefix that is appended to all written messages.- See Also:
- Constant Field Values
-
printStream
private final java.io.PrintStream printStream
The print stream to delegate to.
-
-
Method Detail
-
toSystemOut
public static Plugin.Engine.Listener.StreamWriting toSystemOut()
Creates a stream writing listener that prints all events onSystem.out
.- Returns:
- A listener that writes events to the system output stream.
-
toSystemError
public static Plugin.Engine.Listener.StreamWriting toSystemError()
Creates a stream writing listener that prints all events onSystem.err
.- Returns:
- A listener that writes events to the system error stream.
-
withTransformationsOnly
public Plugin.Engine.Listener withTransformationsOnly()
Returns a new listener that only prints transformation and error events.- Returns:
- A new listener that only prints transformation and error events.
-
withErrorsOnly
public Plugin.Engine.Listener withErrorsOnly()
Returns a new listener that only prints error events.- Returns:
- A new listener that only prints error events.
-
onDiscovery
public void onDiscovery(java.lang.String typeName)
Invoked upon discovering a type but prior to its resolution.- Specified by:
onDiscovery
in interfacePlugin.Engine.Listener
- Overrides:
onDiscovery
in classPlugin.Engine.Listener.Adapter
- Parameters:
typeName
- The name of the discovered type.
-
onTransformation
public void onTransformation(TypeDescription typeDescription, Plugin plugin)
Invoked after a type was transformed using a specific plugin.- Specified by:
onTransformation
in interfacePlugin.Engine.Listener
- Overrides:
onTransformation
in classPlugin.Engine.Listener.Adapter
- Parameters:
typeDescription
- The type being transformed.plugin
- The plugin that was applied.
-
onIgnored
public void onIgnored(TypeDescription typeDescription, Plugin plugin)
Invoked if a type description is ignored by a given plugin. This callback is not invoked, if the ignore type matcher excluded a type from transformation.- Specified by:
onIgnored
in interfacePlugin.Engine.Listener
- Overrides:
onIgnored
in classPlugin.Engine.Listener.Adapter
- Parameters:
typeDescription
- The type being transformed.plugin
- The plugin that ignored the given type.
-
onError
public void onError(TypeDescription typeDescription, Plugin plugin, java.lang.Throwable throwable)
Invoked if an error occured during a plugin's application on a given type.- Specified by:
onError
in interfacePlugin.Engine.ErrorHandler
- Overrides:
onError
in classPlugin.Engine.Listener.Adapter
- Parameters:
typeDescription
- The type being matched or transformed.plugin
- The plugin being applied.throwable
- The throwable that caused the error.
-
onError
public void onError(Plugin plugin, java.lang.Throwable throwable)
Invoked at the end of the build if a plugin could not be closed.- Specified by:
onError
in interfacePlugin.Engine.ErrorHandler
- Overrides:
onError
in classPlugin.Engine.Listener.Adapter
- Parameters:
plugin
- The plugin that could not be closed.throwable
- The error that was caused when the plugin was attempted to be closed.
-
onUnresolved
public void onUnresolved(java.lang.String typeName)
Invoked if a type could not be resolved.- Specified by:
onUnresolved
in interfacePlugin.Engine.ErrorHandler
- Overrides:
onUnresolved
in classPlugin.Engine.Listener.Adapter
- Parameters:
typeName
- The name of the unresolved type.
-
onLiveInitializer
public void onLiveInitializer(TypeDescription typeDescription, TypeDescription definingType)
Invoked if a type transformation implied a live initializer.- Specified by:
onLiveInitializer
in interfacePlugin.Engine.ErrorHandler
- Overrides:
onLiveInitializer
in classPlugin.Engine.Listener.Adapter
- Parameters:
typeDescription
- The type that was transformed.definingType
- The type that implies the initializer which might be the type itself or an auxiliary type.
-
onComplete
public void onComplete(TypeDescription typeDescription)
Invoked upon completing handling a type that was either transformed or ignored.- Specified by:
onComplete
in interfacePlugin.Engine.Listener
- Overrides:
onComplete
in classPlugin.Engine.Listener.Adapter
- Parameters:
typeDescription
- The type that was transformed.
-
onManifest
public void onManifest(java.util.jar.Manifest manifest)
Invoked when a manifest was found or found missing.- Specified by:
onManifest
in interfacePlugin.Engine.ErrorHandler
- Overrides:
onManifest
in classPlugin.Engine.Listener.Adapter
- Parameters:
manifest
- The located manifest ornull
if no manifest was found.
-
onResource
public void onResource(java.lang.String name)
Invoked if a resource that is not a class file is discovered.- Specified by:
onResource
in interfacePlugin.Engine.ErrorHandler
- Overrides:
onResource
in classPlugin.Engine.Listener.Adapter
- Parameters:
name
- The name of the discovered resource.
-
-