Top Description Inners Methods
net.bytebuddy.dynamic.scaffold

public Interface TypeInitializer

extends ByteCodeAppender
Known Direct Implementers
net.bytebuddy.dynamic.scaffold.TypeInitializer.None, net.bytebuddy.dynamic.scaffold.TypeInitializer.Simple
Imports
net.bytebuddy.build.HashCodeAndEqualsPlugin, net.bytebuddy.description.method.MethodDescription, net.bytebuddy.description.type.TypeDescription, net.bytebuddy.implementation.Implementation, net.bytebuddy.implementation.attribute.AnnotationValueFilter, net.bytebuddy.implementation.bytecode.ByteCodeAppender, net.bytebuddy.jar.asm.ClassVisitor, .MethodVisitor

A type initializer is responsible for defining a type's static initialization block.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
TypeInitializer.Drain

A drain for writing a type initializer.

public static enum
TypeInitializer.None

Canonical implementation of a non-defined type initializer.

public static class
TypeInitializer.Simple

A simple, defined type initializer that executes a given ByteCodeAppender.

Method Summary

Modifier and TypeMethod and Description
public TypeInitializer

Returns:

A defined type initializer.
expandWith
(ByteCodeAppender
The byte code appender to apply as the type initializer.
byteCodeAppender
)

Expands this type initializer with another byte code appender.

public boolean

Returns:

true if this type initializer is defined.
isDefined
()

Indicates if this type initializer is defined.

public TypeWriter.MethodPool.Record

Returns:

A new record that represents the supplied record while also executing this type initializer.
wrap
(TypeWriter.MethodPool.Record
The record to wrap.
record
)

Creates a method pool record that applies this type initializer while preserving the record that was supplied.

Inherited from net.bytebuddy.implementation.bytecode.ByteCodeAppender:
apply

Method Detail

expandWithback to summary
public TypeInitializer expandWith(ByteCodeAppender byteCodeAppender)

Expands this type initializer with another byte code appender. For this to be possible, this type initializer must be defined.

Parameters
byteCodeAppender:ByteCodeAppender

The byte code appender to apply as the type initializer.

Returns:TypeInitializer

A defined type initializer.

isDefinedback to summary
public boolean isDefined()

Indicates if this type initializer is defined.

Returns:boolean

true if this type initializer is defined.

wrapback to summary
public TypeWriter.MethodPool.Record wrap(TypeWriter.MethodPool.Record record)

Creates a method pool record that applies this type initializer while preserving the record that was supplied.

Parameters
record:TypeWriter.MethodPool.Record

The record to wrap.

Returns:TypeWriter.MethodPool.Record

A new record that represents the supplied record while also executing this type initializer.

net.bytebuddy.dynamic.scaffold back to summary

public Interface TypeInitializer.Drain

Known Direct Implementers
net.bytebuddy.dynamic.scaffold.TypeInitializer.Drain.Default, net.bytebuddy.dynamic.scaffold.TypeWriter.Default.ForInlining.WithFullProcessing.InitializationHandler.Appending, net.bytebuddy.dynamic.scaffold.TypeWriter.Default.ForInlining.WithDecorationOnly.DecorationClassVisitor

A drain for writing a type initializer.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
TypeInitializer.Drain.Default

A default implementation of a type initializer drain that creates a initializer method.

Method Summary

Modifier and TypeMethod and Description
public void
apply(ClassVisitor
The class visitor to apply the initializer to.
classVisitor
,
TypeInitializer
The type initializer to write.
typeInitializer
,
Implementation.Context
The corresponding implementation context.
implementationContext
)

Applies the drain.

Method Detail

applyback to summary
public void apply(ClassVisitor classVisitor, TypeInitializer typeInitializer, Implementation.Context implementationContext)

Applies the drain.

Parameters
classVisitor:ClassVisitor

The class visitor to apply the initializer to.

typeInitializer:TypeInitializer

The type initializer to write.

implementationContext:Implementation.Context

The corresponding implementation context.

net.bytebuddy.dynamic.scaffold back to summary

public Class TypeInitializer.Drain.Default

extends Object
implements Drain
Class Inheritance
All Implemented Interfaces
net.bytebuddy.dynamic.scaffold.TypeInitializer.Drain
Known Direct Subclasses
net.bytebuddy.dynamic.scaffold.TypeWriter.Default.ForInlining.WithFullProcessing.InitializationHandler.Creating
Annotations
@Enhance

A default implementation of a type initializer drain that creates a initializer method.

Field Summary

Modifier and TypeField and Description
protected final AnnotationValueFilter.Factory
annotationValueFilterFactory

The annotation value filter factory to use.

protected final TypeDescription
instrumentedType

The instrumented type.

protected final TypeWriter.MethodPool
methodPool

The method pool to use.

Constructor Summary

AccessConstructor and Description
public
Default(TypeDescription
The instrumented type.
instrumentedType
,
TypeWriter.MethodPool
The method pool to use.
methodPool
,
AnnotationValueFilter.Factory
The annotation value filter factory to use.
annotationValueFilterFactory
)

Creates a new default type initializer drain.

Method Summary

Modifier and TypeMethod and Description
public void
apply(ClassVisitor
The class visitor to apply the initializer to.
classVisitor
,
TypeInitializer
The type initializer to write.
typeInitializer
,
Implementation.Context
The corresponding implementation context.
implementationContext
)

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.Drain.apply.

Applies the drain.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

annotationValueFilterFactoryback to summary
protected final AnnotationValueFilter.Factory annotationValueFilterFactory

The annotation value filter factory to use.

instrumentedTypeback to summary
protected final TypeDescription instrumentedType

The instrumented type.

methodPoolback to summary
protected final TypeWriter.MethodPool methodPool

The method pool to use.

Constructor Detail

Defaultback to summary
public Default(TypeDescription instrumentedType, TypeWriter.MethodPool methodPool, AnnotationValueFilter.Factory annotationValueFilterFactory)

Creates a new default type initializer drain.

Parameters
instrumentedType:TypeDescription

The instrumented type.

methodPool:TypeWriter.MethodPool

The method pool to use.

annotationValueFilterFactory:AnnotationValueFilter.Factory

The annotation value filter factory to use.

Method Detail

applyback to summary
public void apply(ClassVisitor classVisitor, TypeInitializer typeInitializer, Implementation.Context implementationContext)

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.Drain.apply.

Doc from net.bytebuddy.dynamic.scaffold.TypeInitializer.Drain.apply.

Applies the drain.

Parameters
classVisitor:ClassVisitor

The class visitor to apply the initializer to.

typeInitializer:TypeInitializer

The type initializer to write.

implementationContext:Implementation.Context

The corresponding implementation context.

net.bytebuddy.dynamic.scaffold back to summary

public final Enum TypeInitializer.None

extends Enum<TypeInitializer.None>
implements TypeInitializer
Class Inheritance
All Implemented Interfaces
net.bytebuddy.dynamic.scaffold.TypeInitializer, net.bytebuddy.implementation.bytecode.ByteCodeAppender

Canonical implementation of a non-defined type initializer.

Field Summary

Modifier and TypeField and Description
public static final TypeInitializer.None
INSTANCE

The singleton instance.

Constructor Summary

AccessConstructor and Description
private
None()

Method Summary

Modifier and TypeMethod and Description
public ByteCodeAppender.Size
apply(MethodVisitor
The method visitor to which the byte code appender writes its code to.
methodVisitor
,
Implementation.Context
The implementation context of the current type creation process.
implementationContext
,
MethodDescription
The method that is the target of the instrumentation.
instrumentedMethod
)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Applies this byte code appender to a type creation process.
public TypeInitializer
expandWith(ByteCodeAppender
The byte code appender to apply as the type initializer.
byteCodeAppenderFactory
)

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.expandWith.

Expands this type initializer with another byte code appender.
public boolean
isDefined()

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.isDefined.

Indicates if this type initializer is defined.
public static TypeInitializer.None
public static TypeInitializer.None[]
public TypeWriter.MethodPool.Record
wrap(TypeWriter.MethodPool.Record
The record to wrap.
record
)

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.wrap.

Creates a method pool record that applies this type initializer while preserving the record that was supplied.
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

INSTANCEback to summary
public static final TypeInitializer.None INSTANCE

The singleton instance.

Constructor Detail

Noneback to summary
private None()

Method Detail

applyback to summary
public ByteCodeAppender.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Doc from net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Applies this byte code appender to a type creation process.

Parameters
methodVisitor:MethodVisitor

The method visitor to which the byte code appender writes its code to.

implementationContext:Implementation.Context

The implementation context of the current type creation process.

instrumentedMethod:MethodDescription

The method that is the target of the instrumentation.

Returns:ByteCodeAppender.Size

The required size for the applied byte code to run.

expandWithback to summary
public TypeInitializer expandWith(ByteCodeAppender byteCodeAppenderFactory)

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.expandWith.

Doc from net.bytebuddy.dynamic.scaffold.TypeInitializer.expandWith.

Expands this type initializer with another byte code appender. For this to be possible, this type initializer must be defined.

Parameters
byteCodeAppenderFactory:ByteCodeAppender

The byte code appender to apply as the type initializer.

Returns:TypeInitializer

A defined type initializer.

isDefinedback to summary
public boolean isDefined()

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.isDefined.

Doc from net.bytebuddy.dynamic.scaffold.TypeInitializer.isDefined.

Indicates if this type initializer is defined.

Returns:boolean

true if this type initializer is defined.

valueOfback to summary
public static TypeInitializer.None valueOf(String name)
valuesback to summary
public static TypeInitializer.None[] values()
wrapback to summary
public TypeWriter.MethodPool.Record wrap(TypeWriter.MethodPool.Record record)

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.wrap.

Doc from net.bytebuddy.dynamic.scaffold.TypeInitializer.wrap.

Creates a method pool record that applies this type initializer while preserving the record that was supplied.

Parameters
record:TypeWriter.MethodPool.Record

The record to wrap.

Returns:TypeWriter.MethodPool.Record

A new record that represents the supplied record while also executing this type initializer.

net.bytebuddy.dynamic.scaffold back to summary

public Class TypeInitializer.Simple

extends Object
implements TypeInitializer
Class Inheritance
All Implemented Interfaces
net.bytebuddy.dynamic.scaffold.TypeInitializer, net.bytebuddy.implementation.bytecode.ByteCodeAppender
Annotations
@Enhance

A simple, defined type initializer that executes a given ByteCodeAppender.

Field Summary

Modifier and TypeField and Description
private final ByteCodeAppender
byteCodeAppender

The byte code appender to apply as the type initializer.

Constructor Summary

AccessConstructor and Description
public
Simple(ByteCodeAppender
The byte code appender to apply as the type initializer.
byteCodeAppender
)

Creates a new simple type initializer.

Method Summary

Modifier and TypeMethod and Description
public ByteCodeAppender.Size
apply(MethodVisitor
The method visitor to which the byte code appender writes its code to.
methodVisitor
,
Implementation.Context
The implementation context of the current type creation process.
implementationContext
,
MethodDescription
The method that is the target of the instrumentation.
instrumentedMethod
)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Applies this byte code appender to a type creation process.
public TypeInitializer
expandWith(ByteCodeAppender
The byte code appender to apply as the type initializer.
byteCodeAppender
)

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.expandWith.

Expands this type initializer with another byte code appender.
public boolean
isDefined()

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.isDefined.

Indicates if this type initializer is defined.
public TypeWriter.MethodPool.Record
wrap(TypeWriter.MethodPool.Record
The record to wrap.
record
)

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.wrap.

Creates a method pool record that applies this type initializer while preserving the record that was supplied.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

byteCodeAppenderback to summary
private final ByteCodeAppender byteCodeAppender

The byte code appender to apply as the type initializer.

Constructor Detail

Simpleback to summary
public Simple(ByteCodeAppender byteCodeAppender)

Creates a new simple type initializer.

Parameters
byteCodeAppender:ByteCodeAppender

The byte code appender to apply as the type initializer.

Method Detail

applyback to summary
public ByteCodeAppender.Size apply(MethodVisitor methodVisitor, Implementation.Context implementationContext, MethodDescription instrumentedMethod)

Implements net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Doc from net.bytebuddy.implementation.bytecode.ByteCodeAppender.apply.

Applies this byte code appender to a type creation process.

Parameters
methodVisitor:MethodVisitor

The method visitor to which the byte code appender writes its code to.

implementationContext:Implementation.Context

The implementation context of the current type creation process.

instrumentedMethod:MethodDescription

The method that is the target of the instrumentation.

Returns:ByteCodeAppender.Size

The required size for the applied byte code to run.

expandWithback to summary
public TypeInitializer expandWith(ByteCodeAppender byteCodeAppender)

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.expandWith.

Doc from net.bytebuddy.dynamic.scaffold.TypeInitializer.expandWith.

Expands this type initializer with another byte code appender. For this to be possible, this type initializer must be defined.

Parameters
byteCodeAppender:ByteCodeAppender

The byte code appender to apply as the type initializer.

Returns:TypeInitializer

A defined type initializer.

isDefinedback to summary
public boolean isDefined()

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.isDefined.

Doc from net.bytebuddy.dynamic.scaffold.TypeInitializer.isDefined.

Indicates if this type initializer is defined.

Returns:boolean

true if this type initializer is defined.

wrapback to summary
public TypeWriter.MethodPool.Record wrap(TypeWriter.MethodPool.Record record)

Implements net.bytebuddy.dynamic.scaffold.TypeInitializer.wrap.

Doc from net.bytebuddy.dynamic.scaffold.TypeInitializer.wrap.

Creates a method pool record that applies this type initializer while preserving the record that was supplied.

Parameters
record:TypeWriter.MethodPool.Record

The record to wrap.

Returns:TypeWriter.MethodPool.Record

A new record that represents the supplied record while also executing this type initializer.