Package net.bytebuddy
@ByDefault
package net.bytebuddy
Byte Buddy is a library for creating Java classes at runtime of a Java program. For this purpose, the
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 overridden to return Hello World!
.-
ClassDescriptionInstances of this class serve as a focus point for configuration of the library's behavior and as an entry point to any form of code generation using the library.An implementation fo the
values
method of an enumeration type.A byte code appender for the type initializer of any enumeration type.A byte code appender for thevalues
method of any enumeration type.A constructor strategy for implementing a Java record.A byte code appender for accessors and the record constructor.Implements the object methods of the Java record type.A wrapper object for representing a validated class file version in the format that is specified by the JVMS.A locator for the executing VM's Java version.A version locator for a resolved class file version.A resolver for the current VM's class file version.An unresolved version locator.A naming strategy for determining a fully qualified name for a dynamically created Java type.An abstract base implementation where the names of redefined and rebased types are retained.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.A naming strategy that appends a given suffix to a name, without a randomized element.A base name resolver is responsible for resolving a name onto which the suffix is appended.A base name resolver that simply returns a fixed value.Uses a specific type's name as the resolved name.Uses the unnamed type's super type's name as the resolved name.A base name resolver that adds the name of the class that is invokingByteBuddy
.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.Deprecated.Deprecated.Deprecated.Deprecated.TypeCache<T>A cache for storing types without strongly referencing any class loader or type.A key used for looking up a previously inserted class loader cache.A simple key based on a collection of types where no type is strongly referenced.Determines the storage format for a cached type.A key used for storing a class loader cache reference.An implementation of aTypeCache
where obsolete references are cleared upon any call.
NamingStrategy.Suffixing.BaseNameResolver
.