Top Description Inners Fields Constructors Methods
net.bytebuddy.asm

public abstract Class ClassVisitorFactory<T>

extends Object
Class Inheritance
Annotations
@Enhance
Type Parameters
<T>
The type of the mapped class visitor.
Imports
net.bytebuddy.ByteBuddy, net.bytebuddy.build.AccessControllerPlugin, .HashCodeAndEqualsPlugin, net.bytebuddy.description.field.FieldDescription, net.bytebuddy.description.method.MethodDescription, net.bytebuddy.description.modifier.FieldManifestation, .Ownership, .Visibility, net.bytebuddy.description.type.TypeDefinition, .TypeDescription, net.bytebuddy.dynamic.DynamicType, net.bytebuddy.dynamic.loading.MultipleParentClassLoader, net.bytebuddy.dynamic.scaffold.TypeValidation, net.bytebuddy.dynamic.scaffold.subclass.ConstructorStrategy, net.bytebuddy.implementation.ExceptionMethod, .FieldAccessor, .Implementation, .MethodCall, net.bytebuddy.implementation.bytecode.ByteCodeAppender, .Duplication, .StackManipulation, .TypeCreation, net.bytebuddy.implementation.bytecode.assign.Assigner, net.bytebuddy.implementation.bytecode.member.FieldAccess, .MethodInvocation, .MethodReturn, .MethodVariableAccess, net.bytebuddy.matcher.ElementMatchers, net.bytebuddy.utility.CompoundList, .OpenedClassReader, net.bytebuddy.utility.nullability.MaybeNull, net.bytebuddy.jar.asm.*, java.lang.reflect.Method, java.security.PrivilegedAction, java.util.*

A factory for wrapping a ClassVisitor in Byte Buddy's package namespace to a ClassVisitor in any other namespace. Note that this API does not allow for the passing of Attributes. which must be filtered or propagated past this translation. If the supplied visitors do not declare a method that Byte Buddy's version of ASM is aware of, an UnsupportedOperationException is thrown.

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
protected static class
ClassVisitorFactory.ConstantArrayTranslator

A method to translate an array of constants from one namespace to another.

protected static class
ClassVisitorFactory.ConstantDynamicTranslator

A method to translate a ConstantDynamic from one namespace to another.

protected static class
ClassVisitorFactory.ConstantTranslator

A method to translate a constant value from one namespace to another.

protected static class
ClassVisitorFactory.CreateClassVisitorFactory<
The type of the class visitor to map to.
S
>

A factory for creating a wrapper for a ClassVisitor.

protected static class
ClassVisitorFactory.FrameTranslator

A method to translate a stack map frame array from one namespace to another.

protected static class
ClassVisitorFactory.HandleTranslator

A method to translate a Handle from one namespace to another.

protected static class
ClassVisitorFactory.LabelArrayTranslator

A method to translate an array of Labels from one namespace to another.

protected static class
ClassVisitorFactory.LabelTranslator

A method to translate a Label from one namespace to another.

protected static class
ClassVisitorFactory.NullCheckedConstruction

An appender that performs a null-checked construction.

protected static class
ClassVisitorFactory.TypePathTranslator

A method to translate a TypePath type from one namespace to another.

Field Summary

Modifier and TypeField and Description
private static final String
DELEGATE

The name of the delegate field containing an equivalent visitor.

private static final String
LABELS

The name of a map with labels that have been translated previously.

private final Class<?>
type

The type of the represented class visitor wrapper.

private static final String
WRAP

The name of the method that wraps a translated visitor, including a null check.

Constructor Summary

AccessConstructor and Description
protected
ClassVisitorFactory(Class<?>
The type of the represented class visitor wrapper.
type
)

Creates a new factory.

Method Summary

Modifier and TypeMethod and Description
private static <
The type of the action's resolved value.
T
>
T

Returns:

The action's resolved value.
doPrivileged
(PrivilegedAction<T>
The action to execute from a privileged context.
action
)

A proxy for java.security.AccessController#doPrivileged that is activated if available.

public Class<?>

Returns:

The ClassVisitor type that this factory represents.
getType
()

Returns the ClassVisitor type that this factory represents.

public static <
The type of the class visitor to map to.
S
>
ClassVisitorFactory<S>

Returns:

A factory for wrapping ClassVisitors in Byte Buddy's and the supplied package namespace.
of
(Class<S>
The type of the translated class visitor.
classVisitor
)

Returns a class visitor factory for the supplied ClassVisitor type.

public static <
The type of the class visitor to map to.
S
>
ClassVisitorFactory<S>

Returns:

A factory for wrapping ClassVisitors in Byte Buddy's and the supplied package namespace.
of
(Class<S>
The type of the translated ClassVisitor.
classVisitor
,
ByteBuddy
The Byte Buddy instance to use.
byteBuddy
)

Returns a class visitor factory for the supplied ClassVisitor type.

private static DynamicType

Returns:

The created dynamic type.
toAttributeWrapper
(DynamicType.Builder<?>
The builder to use for the wrapper type.
builder
,
Class<?>
The Attribute type in the original namespace.
source
,
Class<?>
The Attribute type in the targeted namespace.
target
,
TypeDescription
The wrapper type for the Attribute type in the original namespace.
sourceWrapper
,
TypeDescription
The wrapper type for the Attribute type in the targeted namespace.
targetWrapper
)

Creates a wrapper type for an Attribute to pass attribues along a visitor chain.

private static MethodCall.ArgumentLoader.Factory

Returns:

An appropriate argument loader factory.
toConvertedParameter
(TypeDescription
The source type.
source
,
Class<?>
The target type.
target
,
String
The name of the method.
method
,
int
The parameter offset
offset
,
boolean
true if the invoked method is virtual.
virtual
)

Creates an argument loader for a method parameter that requires conversion.

private static DynamicType.Builder<?>

Returns:

The created builder.
toMethodVisitorBuilder
(ByteBuddy
The Byte Buddy instance to use.
byteBuddy
,
Class<?>
The visitor type to map from.
sourceVisitor
,
Class<?>
The visitor type to map to.
targetVisitor
,
Class<?>
The TypePath source type.
sourceTypePath
,
Class<?>
The TypePath target type.
targetTypePath
,
Class<?>
The Label source type.
sourceLabel
,
Class<?>
The Label target type.
targetLabel
,
Class<?>
The Type source type.
sourceType
,
Class<?>
The Type target type.
targetType
,
Class<?>
The Handle source type.
sourceHandle
,
Class<?>
The Handle target type.
targetHandle
,
Class<?>
The ConstantDynamic source type.
sourceConstantDynamic
,
Class<?>
The ConstantDynamic target type.
targetConstantDynamic
)

Creates a builder for a method visitor type.

private static DynamicType.Builder<?>

Returns:

The created builder.
toVisitorBuilder
(ByteBuddy
The Byte Buddy instance to use.
byteBuddy
,
Class<?>
The visitor type to map from.
sourceVisitor
,
Class<?>
The visitor type to map to.
targetVisitor
,
Class<?>
The TypePath source type.
sourceTypePath
,
Class<?>
The TypePath target type.
targetTypePath
,
Implementation
The implementation to append to the constructor.
appendix
)

Creates a builder for a visitor type.

public abstract ClassVisitor

Returns:

A class visitor that unwraps the supplied class visitor.
unwrap
(T
The class visitor to unwrap.
classVisitor
)

Unwraps an instance of the supplied class visitor as a ClassVisitor.

public abstract T

Returns:

A class visitor that wraps the supplied class visitor.
wrap
(ClassVisitor
The class visitor to wrap.
classVisitor
)

Wraps a ClassVisitor within an instance of the supplied class visitor type.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait