AbstractClassGenerator.
Generates names such as
org.springframework.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 |
|---|---|
| public static final DefaultNamingPolicy | |
| private static final boolean | STRESS_HASH_CODE
This allows to test collisions of |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. o)Overrides java. Implements org. NamingPolicy in use does not currently, but may
in the future, affect the caching of classes generated by AbstractClassGenerator, so this is a reminder that you should
correctly implement equals and hashCode
to avoid generating too many classes.
|
| public String | getClassName(String
a dotted-name chosen by the generating class (possibly to put the generated class in a particular package) prefix, String the fully-qualified class name of the generating class (for example "org.springframework.cglib.Enhancer") source, Object 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, Predicate key.hashCode() into the class name.a predicate that returns true if the given classname has already been used in the same ClassLoader. names)Implements org. |
| protected String | |
| public int |
| INSTANCE | back to summary |
|---|---|
| public static final DefaultNamingPolicy INSTANCE | |
| STRESS_HASH_CODE | back to summary |
|---|---|
| private static final boolean STRESS_HASH_CODE This allows to test collisions of | |
| DefaultNamingPolicy | back to summary |
|---|---|
| public DefaultNamingPolicy() | |
| equals | back to summary |
|---|---|
| public boolean equals(Object o) Overrides java. Implements org. Doc from org. The
| |
| getClassName | back to summary |
|---|---|
| public String getClassName(String prefix, String source, Object key, Predicate names) Implements org. Doc from org. Choose a name for a generated class.
| |
| getTag | back to summary |
|---|---|
| protected String getTag() Returns a string which is incorporated into every generated class name. By default returns "ByCGLIB" | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |