See: Description
Interface | Description |
---|---|
ByteBuddy.Definable<T> |
Any definable instance is either
ByteBuddy.Definable.Defined when a value is provided
or ByteBuddy.Definable.Undefined if a value is not provided. |
ByteBuddy.MethodInterceptable |
Implementations of this interface are capable of defining a method interception for a given set of methods.
|
NamingStrategy |
A naming strategy for finding a fully qualified internalName for a Java type.
|
NamingStrategy.UnnamedType |
An description of a type which is to be named.
|
Class | Description |
---|---|
ByteBuddy |
ByteBuddy is a configurable factory for creating DynamicType s which represent
dynamically created Java Class es which can be saved on disk or loaded into the Java virtual
machine. |
ByteBuddy.Definable.Defined<T> |
A representation of a defined
ByteBuddy.Definable for a given value. |
ByteBuddy.Definable.Undefined<T> |
A representation of an undefined
ByteBuddy.Definable . |
ByteBuddy.MethodAnnotationTarget |
A
ByteBuddy configuration with a selected set of methods for which annotations can
be defined. |
ClassFileVersion |
A wrapper object for representing a validated class file version in the format that is specified by the
JVMS.
|
NamingStrategy.Fixed |
A naming strategy that applies a fixed internalName.
|
NamingStrategy.SuffixingRandom |
A naming strategy that creates a internalName by concatenating
The super classes package and internalName
A given suffix string
A random number
Between all these elements, a
$ sign is included into the internalName to improve readability. |
ByteBuddy
class serves as an entry point. The following example
Class<?> dynamicType = new ByteBuddy() .subclass(Object.class) .implement(Serializable.class) .intercept(named("toString"), FixedValue.value("Hello World!")) .make() .load(getClass().getClassLoader(), ClassLoadingStrategy.Default.WRAPPER) .getLoaded(); dynamicType.newInstance().toString; // returns "Hello World!"creates a subclass of the
Object
class which implements the Serializable
interface. The Object.toString()
method is overriden to return Hello World!
.Copyright © 2014. All rights reserved.