Top Description Fields Constructors Methods
org.springframework.cglib.core

public final Class SpringNamingPolicy

extends Object
implements NamingPolicy
Class Inheritance
All Implemented Interfaces
org.springframework.cglib.core.NamingPolicy

Custom variant of CGLIB's DefaultNamingPolicy, modifying the tag in generated class names from "EnhancerByCGLIB" etc to a "SpringCGLIB" tag and using a plain counter suffix instead of a hash code suffix (as of 6.0).

This allows for reliably discovering pre-generated Spring proxy classes in the classpath.

Authors
Juergen Hoeller, Sam Brannen
Since
3.2.8 / 6.0

Field Summary

Modifier and TypeField and Description
private static final String
public static final SpringNamingPolicy
private static final String

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
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.hashCode() into the class name.
key
,
Predicate
a predicate that returns true if the given classname has already been used in the same ClassLoader.
names
)

Implements org.springframework.cglib.core.NamingPolicy.getClassName.

Choose a name for a generated class.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

FAST_CLASS_SUFFIXback to summary
private static final String FAST_CLASS_SUFFIX
INSTANCEback to summary
public static final SpringNamingPolicy INSTANCE
SPRING_LABELback to summary
private static final String SPRING_LABEL

Constructor Detail

SpringNamingPolicyback to summary
private SpringNamingPolicy()

Method Detail

getClassNameback to summary
public String getClassName(String prefix, String source, Object key, Predicate names)

Implements org.springframework.cglib.core.NamingPolicy.getClassName.

Doc from org.springframework.cglib.core.NamingPolicy.getClassName.

Choose a name for a generated class.

Parameters
prefix:String

a dotted-name chosen by the generating class (possibly to put the generated class in a particular package)

source:String

the fully-qualified class name of the generating class (for example "org.springframework.cglib.Enhancer")

key: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.hashCode() into the class name.

names:Predicate

a predicate that returns true if the given classname has already been used in the same ClassLoader.

Returns:String

the fully-qualified class name

Annotations
@Override