See: Description
Interface | Description |
---|---|
ClassFileVersion.VersionLocator |
A locator for the executing VM's Java version.
|
NamingStrategy |
A naming strategy for determining a fully qualified name for a dynamically created Java type.
|
NamingStrategy.SuffixingRandom.BaseNameResolver |
A base name resolver is responsible for resolving a name onto which the suffix is appended.
|
Class | Description |
---|---|
ByteBuddy |
Instances 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.
|
ByteBuddy.EnumerationImplementation |
An implementation fo the
values method of an enumeration type. |
ByteBuddy.EnumerationImplementation.InitializationAppender |
A byte code appender for the type initializer of any enumeration type.
|
ByteBuddy.EnumerationImplementation.ValuesMethodAppender |
A byte code appender for the
values method of any enumeration type. |
ClassFileVersion |
A wrapper object for representing a validated class file version in the format that is specified by the
JVMS.
|
ClassFileVersion.VersionExtractor |
A simple visitor that extracts the class file version of a class file.
|
ClassFileVersion.VersionLocator.ForJava9CapableVm |
A version locator for a JVM of at least version 9.
|
NamingStrategy.AbstractBase |
An abstract base implementation where the names of redefined and rebased types are retained.
|
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. |
NamingStrategy.SuffixingRandom.BaseNameResolver.ForFixedValue |
A base name resolver that simply returns a fixed value.
|
NamingStrategy.SuffixingRandom.BaseNameResolver.ForGivenType |
Uses a specific type's name as the resolved name.
|
Enum | Description |
---|---|
ClassFileVersion.VersionLocator.ForLegacyVm |
A version locator for a JVM that does not provide the
jdk.Version class. |
NamingStrategy.SuffixingRandom.BaseNameResolver.ForUnnamedType |
Uses the unnamed type's super type's name as the resolved name.
|
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–2016. All rights reserved.