Package net.bytebuddy
Class NamingStrategy.SuffixingRandom
java.lang.Object
net.bytebuddy.NamingStrategy.AbstractBase
net.bytebuddy.NamingStrategy.Suffixing
net.bytebuddy.NamingStrategy.SuffixingRandom
- All Implemented Interfaces:
NamingStrategy
- Enclosing interface:
NamingStrategy
A naming strategy that creates a name by concatenating:
- The super classes package and name
- A given suffix string
- A random number
$
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.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
Deprecated.Nested classes/interfaces inherited from interface net.bytebuddy.NamingStrategy
NamingStrategy.AbstractBase, NamingStrategy.PrefixingRandom, NamingStrategy.Suffixing, NamingStrategy.SuffixingRandom
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final RandomString
An instance for creating random seed values.Fields inherited from interface net.bytebuddy.NamingStrategy
BYTE_BUDDY_RENAME_PACKAGE, NO_PREFIX
-
Constructor Summary
ConstructorsConstructorDescriptionSuffixingRandom
(String suffix) Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into Byte Buddy's package namespace.SuffixingRandom
(String suffix, String javaLangPackagePrefix) Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into Byte Buddy's package namespace.SuffixingRandom
(String suffix, NamingStrategy.Suffixing.BaseNameResolver baseNameResolver) Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into Byte Buddy's package namespace.SuffixingRandom
(String suffix, NamingStrategy.Suffixing.BaseNameResolver baseNameResolver, String javaLangPackagePrefix) Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into a given namespace.SuffixingRandom
(String suffix, NamingStrategy.Suffixing.BaseNameResolver baseNameResolver, String javaLangPackagePrefix, RandomString randomString) Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into a given namespace.SuffixingRandom
(String suffix, NamingStrategy.SuffixingRandom.BaseNameResolver baseNameResolver) Deprecated.SuffixingRandom
(String suffix, NamingStrategy.SuffixingRandom.BaseNameResolver baseNameResolver, String javaLangPackagePrefix) SuffixingRandom
(String suffix, NamingStrategy.SuffixingRandom.BaseNameResolver baseNameResolver, String javaLangPackagePrefix, RandomString randomString) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
name
(TypeDescription superClass) Determines a new name when creating a new type that subclasses the provided type.Methods inherited from class net.bytebuddy.NamingStrategy.AbstractBase
rebase, redefine, subclass
-
Field Details
-
randomString
An instance for creating random seed values.
-
-
Constructor Details
-
SuffixingRandom
Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into Byte Buddy's package namespace. All names are derived from the unnamed type's super type.- Parameters:
suffix
- The suffix for the generated class.
-
SuffixingRandom
Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into Byte Buddy's package namespace.- Parameters:
suffix
- The suffix for the generated class.javaLangPackagePrefix
- The fallback namespace for type's that subclass types within thejava.*
namespace. If The prefix is set to the empty string, no prefix is added.
-
SuffixingRandom
@Deprecated public SuffixingRandom(String suffix, NamingStrategy.SuffixingRandom.BaseNameResolver baseNameResolver) Deprecated.Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into Byte Buddy's package namespace.- Parameters:
suffix
- The suffix for the generated class.baseNameResolver
- The base name resolver that is queried for locating the base name.
-
SuffixingRandom
Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into Byte Buddy's package namespace.- Parameters:
suffix
- The suffix for the generated class.baseNameResolver
- The base name resolver that is queried for locating the base name.
-
SuffixingRandom
@Deprecated public 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 thejava.lang
package into a given namespace.- Parameters:
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 thejava.*
namespace. If The prefix is set to the empty string, no prefix is added.
-
SuffixingRandom
public SuffixingRandom(String suffix, NamingStrategy.Suffixing.BaseNameResolver baseNameResolver, String javaLangPackagePrefix) Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into a given namespace.- Parameters:
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 thejava.*
namespace. If The prefix is set to the empty string, no prefix is added.
-
SuffixingRandom
@Deprecated public SuffixingRandom(String suffix, NamingStrategy.SuffixingRandom.BaseNameResolver baseNameResolver, String javaLangPackagePrefix, RandomString randomString) Deprecated.Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into a given namespace.- Parameters:
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 thejava.*
namespace. If The prefix is set to the empty string, no prefix is added.randomString
- The random string instance to use.
-
SuffixingRandom
public SuffixingRandom(String suffix, NamingStrategy.Suffixing.BaseNameResolver baseNameResolver, String javaLangPackagePrefix, RandomString randomString) Creates an immutable naming strategy with a given suffix but moves types that subclass types within thejava.lang
package into a given namespace.- Parameters:
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 thejava.*
namespace. If The prefix is set to the empty string, no prefix is added.randomString
- The random string instance to use.
-
-
Method Details
-
name
Description copied from class:NamingStrategy.AbstractBase
Determines a new name when creating a new type that subclasses the provided type.- Overrides:
name
in classNamingStrategy.Suffixing
- Parameters:
superClass
- The super type of the created type.- Returns:
- The name of the dynamic type.
-
NamingStrategy.Suffixing.BaseNameResolver
.