类 DefaultNamingPolicy

  • 所有已实现的接口:
    NamingPolicy

    public class DefaultNamingPolicy
    extends java.lang.Object
    implements NamingPolicy
    The default policy used by 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.

    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      boolean equals​(java.lang.Object o)
      The 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.
      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.
      protected java.lang.String getTag()
      Returns a string which is incorporated into every generated class name.
      int hashCode()  
      • 从类继承的方法 java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • 构造器详细资料

      • DefaultNamingPolicy

        public DefaultNamingPolicy()
    • 方法详细资料

      • getClassName

        public java.lang.String getClassName​(java.lang.String prefix,
                                             java.lang.String source,
                                             java.lang.Object key,
                                             Predicate names)
        从接口复制的说明: NamingPolicy
        Choose a name for a generated class.
        指定者:
        getClassName 在接口中 NamingPolicy
        参数:
        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 "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.
        返回:
        the fully-qualified class name
      • getTag

        protected java.lang.String getTag()
        Returns a string which is incorporated into every generated class name. By default returns "ByCGLIB"
      • hashCode

        public int hashCode()
        覆盖:
        hashCode 在类中 java.lang.Object
      • equals

        public boolean equals​(java.lang.Object o)
        从接口复制的说明: NamingPolicy
        The 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.
        指定者:
        equals 在接口中 NamingPolicy
        覆盖:
        equals 在类中 java.lang.Object