public static class NamingStrategy.SuffixingRandom extends Object implements NamingStrategy
$
sign is included into the name to improve readability. As an exception,
types that subclass classes from the java.**
packages are prefixed with a given package. This is
necessary as it is illegal to define non-bootstrap classes in this name space. The same strategy is applied
when subclassing a signed type which is equally illegal.Modifier and Type | Class and Description |
---|---|
static interface |
NamingStrategy.SuffixingRandom.BaseNameResolver
A base name resolver is responsible for resolving a name onto which the suffix is appended.
|
NamingStrategy.Fixed, NamingStrategy.PrefixingRandom, NamingStrategy.SuffixingRandom, NamingStrategy.Unbound, NamingStrategy.UnnamedType
Modifier and Type | Field and Description |
---|---|
static String |
BYTE_BUDDY_RENAME_PACKAGE
The default package for defining types that are renamed to not be contained in the
JAVA_PACKAGE package. |
Constructor and Description |
---|
SuffixingRandom(String suffix)
Creates an immutable naming strategy with a given suffix but moves types that subclass types within
the
java.lang package into Byte Buddy's package namespace. |
SuffixingRandom(String suffix,
NamingStrategy.SuffixingRandom.BaseNameResolver baseNameResolver)
Creates an immutable naming strategy with a given suffix but moves types that subclass types within
the
java.lang package into Byte Buddy's package namespace. |
SuffixingRandom(String suffix,
NamingStrategy.SuffixingRandom.BaseNameResolver baseNameResolver,
String javaLangPackagePrefix)
Creates an immutable naming strategy with a given suffix but moves types that subclass types within
the
java.lang package into a given namespace. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object other) |
int |
hashCode() |
String |
name(NamingStrategy.UnnamedType unnamedType)
Generates a fully qualified name for a Java type.
|
String |
toString() |
public static final String BYTE_BUDDY_RENAME_PACKAGE
JAVA_PACKAGE
package.public SuffixingRandom(String suffix)
java.lang
package into Byte Buddy's package namespace. All names are derived from the
unnamed type's super type.suffix
- The suffix for the generated class.public SuffixingRandom(String suffix, NamingStrategy.SuffixingRandom.BaseNameResolver baseNameResolver)
java.lang
package into Byte Buddy's package namespace.suffix
- The suffix for the generated class.baseNameResolver
- The base name resolver that is queried for locating the base name.public SuffixingRandom(String suffix, NamingStrategy.SuffixingRandom.BaseNameResolver baseNameResolver, String javaLangPackagePrefix)
java.lang
package into a given namespace.suffix
- The suffix for the generated class.baseNameResolver
- The base name resolver that is queried for locating the base name.javaLangPackagePrefix
- The fallback namespace for type's that subclass types within the
java.lang
namespace.public String name(NamingStrategy.UnnamedType unnamedType)
NamingStrategy
java.lang
package since such types cannot be loaded using a normal class loader. Also, the name should not yet be taken
by another type since this would cause conflicts in the name space. Therefore, it is recommendable to include
a random sequence within the name.name
in interface NamingStrategy
unnamedType
- An unnamed type that is to be named.Copyright © 2014–2015. All rights reserved.