Package io.netty.util

Class ConstantPool<T extends Constant<T>>

  • Type Parameters:
    T - the type of the constant

    public abstract class ConstantPool<T extends Constant<T>>
    extends java.lang.Object
    A pool of Constants.
    • Constructor Detail

      • ConstantPool

        public ConstantPool()
    • Method Detail

      • valueOf

        public T valueOf​(java.lang.String name)
        Returns the Constant which is assigned to the specified name. If there's no such Constant, a new one will be created and returned. Once created, the subsequent calls with the same name will always return the previously created one (i.e. singleton.)
        Parameters:
        name - the name of the Constant
      • exists

        public boolean exists​(java.lang.String name)
        Returns true if a AttributeKey exists for the given name.
      • newInstance

        public T newInstance​(java.lang.String name)
        Creates a new Constant for the given name or fail with an IllegalArgumentException if a Constant for the given name exists.
      • newConstant

        protected abstract T newConstant​(int id,
                                         java.lang.String name)
      • nextId

        @Deprecated
        public final int nextId()
        Deprecated.