public class DefaultNamingPolicy extends java.lang.Object implements NamingPolicy
AbstractClassGenerator.
Generates names such as
net.sf.cglib.Foo$$EnhancerByCGLIB$$38272841
This is composed of a prefix based on the name of the superclass, a fixed
string incorporating the CGLIB class responsible for generation, and a
hashcode derived from the parameters used to create the object. If the same
name has been previously been used in the same ClassLoader, a
suffix is added to ensure uniqueness.
| Modifier and Type | Field and Description |
|---|---|
static DefaultNamingPolicy |
INSTANCE |
| Constructor and Description |
|---|
DefaultNamingPolicy() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getClassName(java.lang.String prefix,
java.lang.String source,
java.lang.Object key,
Predicate names)
Choose a name for a generated class.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitequalspublic static final DefaultNamingPolicy INSTANCE
public java.lang.String getClassName(java.lang.String prefix,
java.lang.String source,
java.lang.Object key,
Predicate names)
NamingPolicygetClassName in interface NamingPolicyprefix - a dotted-name chosen by the generating class (possibly to put the generated class in a particular package)source - the fully-qualified class name of the generating class (for example "net.sf.cglib.Enhancer")key - A key object representing the state of the parameters; for caching to work properly, equal keys should result
in the same generated class name. The default policy incorporates key.hashCode() into the class name.names - a predicate that returns true if the given classname has already been used in the same ClassLoader.Copyright (c) 2001 - Apache Software Foundation