Package org.springframework.cglib.core
Class DefaultNamingPolicy
java.lang.Object
org.springframework.cglib.core.DefaultNamingPolicy
- All Implemented Interfaces:
 NamingPolicy
The default policy used by 
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.
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionbooleanTheNamingPolicyin use does not currently, but may in the future, affect the caching of classes generated byAbstractClassGenerator, so this is a reminder that you should correctly implementequalsandhashCodeto avoid generating too many classes.getClassName(String prefix, String source, Object key, Predicate names) Choose a name for a generated class.protected StringgetTag()Returns a string which is incorporated into every generated class name.inthashCode() 
- 
Field Details
- 
INSTANCE
 
 - 
 - 
Constructor Details
- 
DefaultNamingPolicy
public DefaultNamingPolicy() 
 - 
 - 
Method Details
- 
getClassName
Description copied from interface:NamingPolicyChoose a name for a generated class.- Specified by:
 getClassNamein interfaceNamingPolicy- Parameters:
 prefix- 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 "org.springframework.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 incorporateskey.hashCode()into the class name.names- a predicate that returns true if the given classname has already been used in the same ClassLoader.- Returns:
 - the fully-qualified class name
 
 - 
getTag
Returns a string which is incorporated into every generated class name. By default returns "ByCGLIB" - 
hashCode
public int hashCode() - 
equals
Description copied from interface:NamingPolicyTheNamingPolicyin use does not currently, but may in the future, affect the caching of classes generated byAbstractClassGenerator, so this is a reminder that you should correctly implementequalsandhashCodeto avoid generating too many classes.- Specified by:
 equalsin interfaceNamingPolicy- Overrides:
 equalsin classObject
 
 -