protected abstract static class ByteBuddy.Proxy extends ByteBuddy
ByteBuddy
configuration.ByteBuddy.Definable<T>, ByteBuddy.MatchedMethodInterception, ByteBuddy.MethodAnnotationTarget, ByteBuddy.MethodInterceptable, ByteBuddy.OptionalMethodInterception, ByteBuddy.Proxy
bridgeMethodResolverFactory, BYTE_BUDDY_DEFAULT_PREFIX, classFileVersion, classVisitorWrapperChain, defaultFieldAttributeAppenderFactory, defaultMethodAttributeAppenderFactory, ignoredMethods, interfaceTypes, methodLookupEngineFactory, methodRegistry, modifiers, namingStrategy, typeAttributeAppender
Modifier | Constructor and Description |
---|---|
protected |
Proxy(ClassFileVersion classFileVersion,
NamingStrategy.Unbound namingStrategy,
List<TypeDescription> interfaceTypes,
ElementMatcher<? super MethodDescription> ignoredMethods,
BridgeMethodResolver.Factory bridgeMethodResolverFactory,
ClassVisitorWrapper.Chain classVisitorWrapperChain,
MethodRegistry methodRegistry,
ByteBuddy.Definable<Integer> modifiers,
TypeAttributeAppender typeAttributeAppender,
MethodLookupEngine.Factory methodLookupEngineFactory,
FieldAttributeAppender.Factory defaultFieldAttributeAppenderFactory,
MethodAttributeAppender.Factory defaultMethodAttributeAppenderFactory)
Defines a new proxy configuration for
ByteBuddy . |
Modifier and Type | Method and Description |
---|---|
ByteBuddy.MatchedMethodInterception |
constructor(ElementMatcher<? super MethodDescription> methodMatcher)
Intercepts a given constructor selection.
|
BridgeMethodResolver.Factory |
getBridgeMethodResolverFactory()
Returns the factory for the bridge method resolver for the current configuration.
|
ClassFileVersion |
getClassFileVersion()
Returns the class file version that is defined for the current configuration.
|
ClassVisitorWrapper.Chain |
getClassVisitorWrapperChain()
Returns the class visitor wrapper chain for the current configuration.
|
FieldAttributeAppender.Factory |
getDefaultFieldAttributeAppenderFactory()
Returns the default field attribute appender factory which is applied to any field that is defined
for instrumentations that are applied by this configuration.
|
MethodAttributeAppender.Factory |
getDefaultMethodAttributeAppenderFactory()
Returns the default method attribute appender factory which is applied to any method that is defined
or intercepted for instrumentations that are applied by this configuration.
|
ElementMatcher<? super MethodDescription> |
getIgnoredMethods()
Returns the matcher for the ignored methods for the current configuration.
|
List<TypeDescription> |
getInterfaceTypes()
Returns the naming strategy for the current configuration.
|
MethodLookupEngine.Factory |
getMethodLookupEngineFactory()
Returns the method lookup engine factory to apply to any type that is generated by this configuration.
|
MethodRegistry |
getMethodRegistry()
Returns the method registry for the current configuration.
|
ByteBuddy.Definable<Integer> |
getModifiers()
Returns the modifiers to apply to any type that is generated by this configuration.
|
NamingStrategy.Unbound |
getNamingStrategy()
Returns the naming strategy for the current configuration.
|
TypeAttributeAppender |
getTypeAttributeAppender()
Returns the type attribute appender factory to apply to any type that is generated by this configuration.
|
ByteBuddy.MatchedMethodInterception |
invokable(ElementMatcher<? super MethodDescription> methodMatcher)
Intercepts a given selection of byte code methods that can be a method or a constructor.
|
protected abstract ByteBuddy |
materialize()
Materializes the current extended configuration.
|
ByteBuddy.MatchedMethodInterception |
method(ElementMatcher<? super MethodDescription> methodMatcher)
Intercepts a given method selection.
|
<T> DynamicType.Builder<T> |
rebase(Class<T> levelType)
Creates a dynamic type by weaving any changes into an already defined level type.
|
<T> DynamicType.Builder<T> |
rebase(Class<T> levelType,
ClassFileLocator classFileLocator)
Creates a dynamic type by weaving any changes into an already defined level type.
|
<T> DynamicType.Builder<T> |
rebase(Class<T> levelType,
ClassFileLocator classFileLocator,
MethodRebaseResolver.MethodNameTransformer methodNameTransformer)
Creates a dynamic type by weaving any changes into an already defined level type.
|
<T> DynamicType.Builder<T> |
rebase(TypeDescription levelType,
ClassFileLocator classFileLocator)
Creates a dynamic type by weaving any changes into an already defined level type.
|
<T> DynamicType.Builder<T> |
rebase(TypeDescription levelType,
ClassFileLocator classFileLocator,
MethodRebaseResolver.MethodNameTransformer methodNameTransformer)
Creates a dynamic type by weaving any changes into an already defined level type.
|
<T> DynamicType.Builder<T> |
redefine(Class<T> levelType)
Creates a dynamic type builder for redefining of the given type.
|
<T> DynamicType.Builder<T> |
redefine(Class<T> levelType,
ClassFileLocator classFileLocator)
Creates a dynamic type builder for redefining of the given type.
|
<T> DynamicType.Builder<T> |
redefine(TypeDescription levelType,
ClassFileLocator classFileLocator)
Creates a dynamic type builder for redefining of the given type.
|
<T> DynamicType.Builder<T> |
subclass(Class<T> superType)
Creates a dynamic type builder that creates a subclass of a given loaded type where the subclass
is created by the
ConstructorStrategy.Default.IMITATE_SUPER_TYPE
strategy. |
<T> DynamicType.Builder<T> |
subclass(Class<T> superType,
ConstructorStrategy constructorStrategy)
Creates a dynamic type builder that creates a subclass of a given loaded type.
|
<T> DynamicType.Builder<T> |
subclass(TypeDescription superType)
Creates a dynamic type builder that creates a subclass of a given type description where the subclass
is created by the
ConstructorStrategy.Default.IMITATE_SUPER_TYPE
strategy. |
<T> DynamicType.Builder<T> |
subclass(TypeDescription superType,
ConstructorStrategy constructorStrategy)
Creates a dynamic type builder that creates a subclass of a given type description.
|
ByteBuddy |
withAttribute(TypeAttributeAppender typeAttributeAppender)
Defines a new type attribute appender for this configuration that replaces the currently defined type
attribute appender.
|
ByteBuddy |
withBridgeMethodResolver(BridgeMethodResolver.Factory bridgeMethodResolverFactory)
Defines a bridge method resolver factory to be applied to this configuration.
|
ByteBuddy |
withClassFileVersion(ClassFileVersion classFileVersion)
Defines a new class file version for this configuration.
|
ByteBuddy |
withClassVisitor(ClassVisitorWrapper classVisitorWrapper)
Defines a new class visitor to be appended to the current collection of
ClassVisitor s
that are to be applied onto any creation process of a dynamic type. |
ByteBuddy |
withDefaultFieldAttributeAppender(FieldAttributeAppender.Factory attributeAppenderFactory)
Defines a new default field attribute appender factory that is applied onto any field.
|
ByteBuddy |
withDefaultMethodAttributeAppender(MethodAttributeAppender.Factory attributeAppenderFactory)
Defines a new default method attribute appender factory that is applied onto any method.
|
ByteBuddy |
withIgnoredMethods(ElementMatcher<? super MethodDescription> ignoredMethods)
Defines a new method matcher for methods that are ignored by any dynamic type that is created by this
configuration which will replace the current configuration.
|
ByteBuddy.OptionalMethodInterception |
withImplementing(Class<?>... type)
Defines all dynamic types that are created by this configuration to implement the given interface.
|
ByteBuddy.OptionalMethodInterception |
withImplementing(TypeDescription... type)
Defines all dynamic types that are created by this configuration to implement the given interface.
|
ByteBuddy |
withMethodLookupEngine(MethodLookupEngine.Factory methodLookupEngineFactory)
Defines a new
MethodLookupEngine.Factory to be used for creating
MethodLookupEngine s for type creations based on this configuration. |
ByteBuddy |
withModifiers(ModifierContributor.ForType... modifierContributor)
Defines a new modifier contributors for this configuration that replaces the currently defined modifier
contributes which might currently be implicit.
|
ByteBuddy |
withNamingStrategy(NamingStrategy.Unbound namingStrategy)
Defines a new naming strategy for this configuration.
|
ByteBuddy |
withNamingStrategy(NamingStrategy namingStrategy)
Defines a new naming strategy for this configuration.
|
ByteBuddy |
withTypeAnnotation(Annotation... annotation)
Defines a new type annotation for this configuration that replaces the currently defined type
attribute appender.
|
equals, hashCode, makeInterface, makeInterface, makeInterface, makeInterface, toString
protected Proxy(ClassFileVersion classFileVersion, NamingStrategy.Unbound namingStrategy, List<TypeDescription> interfaceTypes, ElementMatcher<? super MethodDescription> ignoredMethods, BridgeMethodResolver.Factory bridgeMethodResolverFactory, ClassVisitorWrapper.Chain classVisitorWrapperChain, MethodRegistry methodRegistry, ByteBuddy.Definable<Integer> modifiers, TypeAttributeAppender typeAttributeAppender, MethodLookupEngine.Factory methodLookupEngineFactory, FieldAttributeAppender.Factory defaultFieldAttributeAppenderFactory, MethodAttributeAppender.Factory defaultMethodAttributeAppenderFactory)
ByteBuddy
.classFileVersion
- The currently defined class file version.namingStrategy
- The currently defined naming strategy.interfaceTypes
- The currently defined collection of interfaces to be
implemented by any dynamically created type.ignoredMethods
- The methods to always be ignored.bridgeMethodResolverFactory
- The bridge method resolver factory to be applied to any
instrumentation process.classVisitorWrapperChain
- The class visitor wrapper chain to be applied to any
instrumentation process.methodRegistry
- The currently valid method registry.modifiers
- The modifiers to define for any instrumentation process.typeAttributeAppender
- The type attribute appender to apply to any instrumentation
process.methodLookupEngineFactory
- The method lookup engine factory to apply to this configuration.defaultFieldAttributeAppenderFactory
- The field attribute appender to apply as a default for any
field definition.defaultMethodAttributeAppenderFactory
- The method attribute appender to apply as a default for any
method definition or instrumentation.public ClassFileVersion getClassFileVersion()
ByteBuddy
getClassFileVersion
in class ByteBuddy
public NamingStrategy.Unbound getNamingStrategy()
ByteBuddy
getNamingStrategy
in class ByteBuddy
public List<TypeDescription> getInterfaceTypes()
ByteBuddy
getInterfaceTypes
in class ByteBuddy
public ElementMatcher<? super MethodDescription> getIgnoredMethods()
ByteBuddy
getIgnoredMethods
in class ByteBuddy
public BridgeMethodResolver.Factory getBridgeMethodResolverFactory()
ByteBuddy
getBridgeMethodResolverFactory
in class ByteBuddy
public ClassVisitorWrapper.Chain getClassVisitorWrapperChain()
ByteBuddy
getClassVisitorWrapperChain
in class ByteBuddy
public MethodRegistry getMethodRegistry()
ByteBuddy
getMethodRegistry
in class ByteBuddy
public ByteBuddy.Definable<Integer> getModifiers()
ByteBuddy
getModifiers
in class ByteBuddy
public MethodLookupEngine.Factory getMethodLookupEngineFactory()
ByteBuddy
getMethodLookupEngineFactory
in class ByteBuddy
public TypeAttributeAppender getTypeAttributeAppender()
ByteBuddy
getTypeAttributeAppender
in class ByteBuddy
public FieldAttributeAppender.Factory getDefaultFieldAttributeAppenderFactory()
ByteBuddy
getDefaultFieldAttributeAppenderFactory
in class ByteBuddy
public MethodAttributeAppender.Factory getDefaultMethodAttributeAppenderFactory()
ByteBuddy
getDefaultMethodAttributeAppenderFactory
in class ByteBuddy
public <T> DynamicType.Builder<T> subclass(Class<T> superType)
ByteBuddy
ConstructorStrategy.Default.IMITATE_SUPER_TYPE
strategy.subclass
in class ByteBuddy
T
- The most specific known type that the created dynamic type represents.superType
- The type or interface to be extended or implemented by the dynamic type.public <T> DynamicType.Builder<T> subclass(Class<T> superType, ConstructorStrategy constructorStrategy)
ByteBuddy
subclass
in class ByteBuddy
T
- The most specific known type that the created dynamic type represents.superType
- The type or interface to be extended or implemented by the dynamic type.constructorStrategy
- The constructor strategy to apply.public <T> DynamicType.Builder<T> subclass(TypeDescription superType)
ByteBuddy
ConstructorStrategy.Default.IMITATE_SUPER_TYPE
strategy.subclass
in class ByteBuddy
T
- The most specific known type that the created dynamic type represents.superType
- The type or interface to be extended or implemented by the dynamic type.public <T> DynamicType.Builder<T> subclass(TypeDescription superType, ConstructorStrategy constructorStrategy)
ByteBuddy
subclass
in class ByteBuddy
T
- The most specific known type that the created dynamic type represents.superType
- The type or interface to be extended or implemented by the dynamic type.constructorStrategy
- The constructor strategy to apply.public <T> DynamicType.Builder<T> redefine(Class<T> levelType)
ByteBuddy
Creates a dynamic type builder for redefining of the given type. The given class must be found on the
class path or by the class's ClassLoader
. Otherwise, the class file to the redefined class
must be located explicitly by providing a locator by
ByteBuddy.redefine(Class, net.bytebuddy.dynamic.ClassFileLocator)
.
Note: It is possible to experience unexpected errors in case that the provided levelType
and the
corresponding class file get out of sync, i.e. a type is redefined several times without providing an updated
version of the class file.
public <T> DynamicType.Builder<T> redefine(Class<T> levelType, ClassFileLocator classFileLocator)
ByteBuddy
Creates a dynamic type builder for redefining of the given type.
Note: It is possible to experience unexpected errors in case that the provided levelType
and the
corresponding class file get out of sync, i.e. a type is redefined several times without providing an updated
version of the class file.
redefine
in class ByteBuddy
T
- The most specific known type that the created dynamic type represents.levelType
- The type to redefine.classFileLocator
- A locator for finding a class file that represents a type.public <T> DynamicType.Builder<T> redefine(TypeDescription levelType, ClassFileLocator classFileLocator)
ByteBuddy
Creates a dynamic type builder for redefining of the given type.
Note: It is possible to experience unexpected errors in case that the provided levelType
and the
corresponding class file get out of sync, i.e. a type is redefined several times without providing an updated
version of the class file.
redefine
in class ByteBuddy
T
- The most specific known type that the created dynamic type represents.levelType
- The type to redefine.classFileLocator
- A locator for finding a class file that represents a type.public <T> DynamicType.Builder<T> rebase(Class<T> levelType)
ByteBuddy
Creates a dynamic type by weaving any changes into an already defined level type. The rebased type is
created by adding methods to the level type where the original method implementations are copied to
renamed, private methods within the created dynamic type and therefore remain invokable as super method calls.
The result is a rebased type with subclass semantics. The given class must be found on the class path or
by the provided class's ClassLoader
. Otherwise, the class file to the redefined class
must be located explicitly by providing a locator by
ByteBuddy.rebase(Class, net.bytebuddy.dynamic.ClassFileLocator)
.
Note: It is possible to experience unexpected errors in case that the provided levelType
and the
corresponding class file get out of sync, i.e. a type is rebased several times without updating the class file.
public <T> DynamicType.Builder<T> rebase(Class<T> levelType, ClassFileLocator classFileLocator)
ByteBuddy
Creates a dynamic type by weaving any changes into an already defined level type. The rebased type is created by adding methods to the level type where the original method implementations are copied to renamed, private methods within the created dynamic type and therefore remain invokable as super method calls. The result is a rebased type with subclass semantics.
Note: It is possible to experience unexpected errors in case that the provided levelType
and the
corresponding class file get out of sync, i.e. a type is rebased several times without updating the class file.
rebase
in class ByteBuddy
T
- The most specific known type that the created dynamic type represents.levelType
- The type which is to be rebased.classFileLocator
- A locator for finding a class file that represents a type.public <T> DynamicType.Builder<T> rebase(Class<T> levelType, ClassFileLocator classFileLocator, MethodRebaseResolver.MethodNameTransformer methodNameTransformer)
ByteBuddy
Creates a dynamic type by weaving any changes into an already defined level type. The rebased type is created by adding methods to the level type where the original method implementations are copied to renamed, private methods within the created dynamic type and therefore remain invokable as super method calls. The result is a rebased type with subclass semantics.
Note: It is possible to experience unexpected errors in case that the provided levelType
and the
corresponding class file get out of sync, i.e. a type is rebased several times without updating the class file.
rebase
in class ByteBuddy
T
- The most specific known type that the created dynamic type represents.levelType
- The type which is to be rebased.classFileLocator
- A locator for finding a class file that represents a type.methodNameTransformer
- The method name transformer that is used for rebasing methods.public <T> DynamicType.Builder<T> rebase(TypeDescription levelType, ClassFileLocator classFileLocator)
ByteBuddy
Creates a dynamic type by weaving any changes into an already defined level type. The rebased type is created by adding methods to the level type where the original method implementations are copied to renamed, private methods within the created dynamic type and therefore remain invokable as super method calls. The result is a rebased type with subclass semantics.
Note: It is possible to experience unexpected errors in case that the provided levelType
and the
corresponding class file get out of sync, i.e. a type is rebased several times without updating the class file.
rebase
in class ByteBuddy
T
- The most specific known type that the created dynamic type represents.levelType
- The type which is to be rebased.classFileLocator
- A locator for finding a class file that represents a type.public <T> DynamicType.Builder<T> rebase(TypeDescription levelType, ClassFileLocator classFileLocator, MethodRebaseResolver.MethodNameTransformer methodNameTransformer)
ByteBuddy
Creates a dynamic type by weaving any changes into an already defined level type. The rebased type is created by adding methods to the level type where the original method implementations are copied to renamed, private methods within the created dynamic type and therefore remain invokable as super method calls. The result is a rebased type with subclass semantics.
Note: It is possible to experience unexpected errors in case that the provided levelType
and the
corresponding class file get out of sync, i.e. a type is rebased several times without updating the class file.
rebase
in class ByteBuddy
T
- The most specific known type that the created dynamic type represents.levelType
- The type which is to be rebased.classFileLocator
- A locator for finding a class file that represents a type.methodNameTransformer
- The method name transformer that is used for rebasing methods.public ByteBuddy withClassFileVersion(ClassFileVersion classFileVersion)
ByteBuddy
withClassFileVersion
in class ByteBuddy
classFileVersion
- The class file version to define for this configuration.public ByteBuddy withNamingStrategy(NamingStrategy.Unbound namingStrategy)
ByteBuddy
withNamingStrategy
in class ByteBuddy
namingStrategy
- The unbound naming strategy to apply to the current configuration.public ByteBuddy withNamingStrategy(NamingStrategy namingStrategy)
ByteBuddy
withNamingStrategy
in class ByteBuddy
namingStrategy
- The naming strategy to apply to the current configuration.public ByteBuddy withModifiers(ModifierContributor.ForType... modifierContributor)
ByteBuddy
withModifiers
in class ByteBuddy
modifierContributor
- The modifier contributors to define explicitly for this configuration.public ByteBuddy withAttribute(TypeAttributeAppender typeAttributeAppender)
ByteBuddy
withAttribute
in class ByteBuddy
typeAttributeAppender
- The type attribute appender to define for this configuration.public ByteBuddy withTypeAnnotation(Annotation... annotation)
ByteBuddy
withTypeAnnotation
in class ByteBuddy
annotation
- The type annotations to define for this configuration.public ByteBuddy.OptionalMethodInterception withImplementing(Class<?>... type)
ByteBuddy
withImplementing
in class ByteBuddy
type
- The interface type to implement.public ByteBuddy.OptionalMethodInterception withImplementing(TypeDescription... type)
ByteBuddy
withImplementing
in class ByteBuddy
type
- The interface type to implement.public ByteBuddy withIgnoredMethods(ElementMatcher<? super MethodDescription> ignoredMethods)
ByteBuddy
withIgnoredMethods
in class ByteBuddy
ignoredMethods
- The methods to always be ignored for any instrumentation.public ByteBuddy withBridgeMethodResolver(BridgeMethodResolver.Factory bridgeMethodResolverFactory)
ByteBuddy
withBridgeMethodResolver
in class ByteBuddy
bridgeMethodResolverFactory
- The bridge method resolver factory to be applied to any instrumentation
process.public ByteBuddy withClassVisitor(ClassVisitorWrapper classVisitorWrapper)
ByteBuddy
ClassVisitor
s
that are to be applied onto any creation process of a dynamic type.withClassVisitor
in class ByteBuddy
classVisitorWrapper
- The class visitor wrapper to ba appended to the current chain of class visitor wrappers.public ByteBuddy withMethodLookupEngine(MethodLookupEngine.Factory methodLookupEngineFactory)
ByteBuddy
MethodLookupEngine.Factory
to be used for creating
MethodLookupEngine
s for type creations based on this configuration.
The default lookup engine queries any class or interface type that is represented by the created type. These
queries might however be costly such that this factory can be configured to save lookup time, for example
by providing additional caching or by providing precomputed results.withMethodLookupEngine
in class ByteBuddy
methodLookupEngineFactory
- The method lookup engine factory to apply to this configuration.public ByteBuddy withDefaultFieldAttributeAppender(FieldAttributeAppender.Factory attributeAppenderFactory)
ByteBuddy
withDefaultFieldAttributeAppender
in class ByteBuddy
attributeAppenderFactory
- The attribute appender factory that is applied as a default on any
field that is created by a dynamic type that is created with this
configuration.public ByteBuddy withDefaultMethodAttributeAppender(MethodAttributeAppender.Factory attributeAppenderFactory)
ByteBuddy
withDefaultMethodAttributeAppender
in class ByteBuddy
attributeAppenderFactory
- The attribute appender factory that is applied as a default on any
method that is created or intercepted by a dynamic type that is created
with this configuration.public ByteBuddy.MatchedMethodInterception invokable(ElementMatcher<? super MethodDescription> methodMatcher)
ByteBuddy
public ByteBuddy.MatchedMethodInterception method(ElementMatcher<? super MethodDescription> methodMatcher)
ByteBuddy
public ByteBuddy.MatchedMethodInterception constructor(ElementMatcher<? super MethodDescription> methodMatcher)
ByteBuddy
constructor
in class ByteBuddy
methodMatcher
- The method matcher representing all constructors to intercept.protected abstract ByteBuddy materialize()
Copyright © 2014–2015. All rights reserved.