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 name for a Java type.
|
NamingStrategy.UnnamedType |
An description of a type which is to be named.
|
Class | Description |
---|---|
ByteBuddy |
ByteBuddy instances are configurable factories for creating new Java types at a JVM's runtime. |
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 name.
|
NamingStrategy.PrefixingRandom |
A naming strategy that creates a name by prefixing a given class and its package with another package and
by appending a random number to the class's simple name.
|
NamingStrategy.SuffixingRandom |
A naming strategy that creates a name by concatenating:
The super classes package and name
A given suffix string
A random number
Between all these elements, a
$ sign is included into the name 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.