Package net.bytebuddy.dynamic
Class DynamicType.Builder.AbstractBase.UsingTypeWriter<U>
java.lang.Object
net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase<U>
net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase.UsingTypeWriter<U>
- Type Parameters:
U
- A loaded type that the built type is guaranteed to be a subclass of.
- All Implemented Interfaces:
DynamicType.Builder<U>
- Direct Known Subclasses:
DecoratingDynamicTypeBuilder
,DynamicType.Builder.AbstractBase.Adapter
- Enclosing class:
DynamicType.Builder.AbstractBase<S>
public abstract static class DynamicType.Builder.AbstractBase.UsingTypeWriter<U>
extends DynamicType.Builder.AbstractBase<U>
A dynamic type writer that uses a
TypeWriter
to create a dynamic type.-
Nested Class Summary
Nested classes/interfaces inherited from class net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase
DynamicType.Builder.AbstractBase.Adapter<U>, DynamicType.Builder.AbstractBase.Delegator<U>, DynamicType.Builder.AbstractBase.UsingTypeWriter<U>
Nested classes/interfaces inherited from interface net.bytebuddy.dynamic.DynamicType.Builder
DynamicType.Builder.AbstractBase<S>, DynamicType.Builder.FieldDefinition<S>, DynamicType.Builder.InnerTypeDefinition<S>, DynamicType.Builder.MethodDefinition<S>, DynamicType.Builder.RecordComponentDefinition<S>, DynamicType.Builder.TypeVariableDefinition<S>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionmake
(TypeResolutionStrategy typeResolutionStrategy) Creates the dynamic type this builder represents.make
(TypeResolutionStrategy typeResolutionStrategy, TypePool typePool) Creates the dynamic type this builder represents.protected abstract TypeWriter
<U> Creates aTypeWriter
without an explicitly specifiedTypePool
.protected abstract TypeWriter
<U> toTypeWriter
(TypePool typePool) Creates aTypeWriter
given the specifiedTypePool
.wrap
(org.objectweb.asm.ClassVisitor classVisitor, int writerFlags, int readerFlags) Wraps a class visitor with the configuration that is represented by this dynamic type builder, using a defaultTypePool
.wrap
(org.objectweb.asm.ClassVisitor classVisitor, TypePool typePool, int writerFlags, int readerFlags) Wraps a class visitor with the configuration that is represented by this dynamic type builder.Methods inherited from class net.bytebuddy.dynamic.DynamicType.Builder.AbstractBase
annotateType, annotateType, annotateType, constructor, declaredTypes, declaredTypes, declaredTypes, define, define, define, define, define, define, defineConstructor, defineConstructor, defineField, defineField, defineField, defineField, defineField, defineMethod, defineMethod, defineMethod, defineMethod, defineMethod, defineProperty, defineProperty, defineProperty, defineProperty, defineRecordComponent, field, ignoreAlso, implement, implement, implement, innerTypeOf, innerTypeOf, innerTypeOf, invokable, make, make, merge, method, modifiers, modifiers, nestHost, nestMembers, nestMembers, nestMembers, noNestMate, permittedSubclass, permittedSubclass, permittedSubclass, recordComponent, require, require, require, serialVersionUid, typeVariable, typeVariable, typeVariable, typeVariable, withHashCodeEquals, withToString, wrap, wrap
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.bytebuddy.dynamic.DynamicType.Builder
annotateType, attribute, declaredTypes, defineConstructor, defineField, defineMethod, defineRecordComponent, field, ignoreAlso, implement, initializer, initializer, innerTypeOf, innerTypeOf, invokable, merge, modifiers, name, nestHost, nestMembers, permittedSubclass, recordComponent, require, suffix, topLevelType, toTypeDescription, transform, typeVariable, unsealed, visit
-
Constructor Details
-
UsingTypeWriter
public UsingTypeWriter()
-
-
Method Details
-
wrap
public ContextClassVisitor wrap(org.objectweb.asm.ClassVisitor classVisitor, int writerFlags, int readerFlags) Wraps a class visitor with the configuration that is represented by this dynamic type builder, using a defaultTypePool
. A wrapper might not apply all features that are normally applied by Byte Buddy, if those features require control of the class loading life cycle. Neither does a wrapper define auxiliary types. It is therefore recommended to useImplementation.Context.Disabled
.- Parameters:
classVisitor
- The class visitor to wrap.writerFlags
- The ASM writer flags to apply.readerFlags
- The ASM reader flags to apply.- Returns:
- A new class visitor that wraps a representation of this dynamic type.
-
wrap
public ContextClassVisitor wrap(org.objectweb.asm.ClassVisitor classVisitor, TypePool typePool, int writerFlags, int readerFlags) Wraps a class visitor with the configuration that is represented by this dynamic type builder. A wrapper might not apply all features that are normally applied by Byte Buddy, if those features require control of the class loading life cycle. Neither does a wrapper define auxiliary types. It is therefore recommended to useImplementation.Context.Disabled
.- Parameters:
classVisitor
- The class visitor to wrap.typePool
- A type pool that is used for computing stack map frames by the underlying class writer, if required.writerFlags
- The ASM writer flags to apply.readerFlags
- The ASM reader flags to apply.- Returns:
- A new class visitor that wraps a representation of this dynamic type.
-
make
Creates the dynamic type this builder represents. If the specified dynamic type is not legal, an
IllegalStateException
is thrown.The dynamic type is initialized using a
TypeResolutionStrategy.Passive
strategy. Using this strategy, noLoadedTypeInitializer
is run during the execution of the type's initializer such that noImplementation
used for executing the initializer must rely on such an initializer.- Parameters:
typeResolutionStrategy
- The type resolution strategy to use for the created type's initialization.- Returns:
- An unloaded dynamic type representing the type specified by this builder.
-
make
public DynamicType.Unloaded<U> make(TypeResolutionStrategy typeResolutionStrategy, TypePool typePool) Creates the dynamic type this builder represents. If the specified dynamic type is not legal, anIllegalStateException
is thrown.- Parameters:
typeResolutionStrategy
- The type resolution strategy to use for the created type's initialization.typePool
- A type pool that is used for computing stack map frames by the underlying class writer, if required.- Returns:
- An unloaded dynamic type representing the type specified by this builder.
-
toTypeWriter
Creates aTypeWriter
without an explicitly specifiedTypePool
.- Returns:
- An appropriate
TypeWriter
.
-
toTypeWriter
Creates aTypeWriter
given the specifiedTypePool
.- Parameters:
typePool
- TheTypePool
to use.- Returns:
- An appropriate
TypeWriter
.
-