Package io.netty.util
Class ConstantPool<T extends Constant<T>>
- java.lang.Object
-
- io.netty.util.ConstantPool<T>
-
-
Constructor Summary
Constructors Constructor Description ConstantPool()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private static java.lang.StringcheckNotNullAndNotEmpty(java.lang.String name)private TcreateOrThrow(java.lang.String name)Creates constant by name or throws exception.booleanexists(java.lang.String name)private TgetOrCreate(java.lang.String name)Get existing constant by name or creates new one if not exists.protected abstract TnewConstant(int id, java.lang.String name)TnewInstance(java.lang.String name)intnextId()Deprecated.TvalueOf(java.lang.Class<?> firstNameComponent, java.lang.String secondNameComponent)TvalueOf(java.lang.String name)Returns theConstantwhich is assigned to the specifiedname.
-
-
-
Method Detail
-
valueOf
public T valueOf(java.lang.Class<?> firstNameComponent, java.lang.String secondNameComponent)
-
valueOf
public T valueOf(java.lang.String name)
Returns theConstantwhich is assigned to the specifiedname. If there's no suchConstant, a new one will be created and returned. Once created, the subsequent calls with the samenamewill always return the previously created one (i.e. singleton.)- Parameters:
name- the name of theConstant
-
getOrCreate
private T getOrCreate(java.lang.String name)
Get existing constant by name or creates new one if not exists. Threadsafe- Parameters:
name- the name of theConstant
-
exists
public boolean exists(java.lang.String name)
-
newInstance
public T newInstance(java.lang.String name)
-
createOrThrow
private T createOrThrow(java.lang.String name)
Creates constant by name or throws exception. Threadsafe- Parameters:
name- the name of theConstant
-
checkNotNullAndNotEmpty
private static java.lang.String checkNotNullAndNotEmpty(java.lang.String name)
-
newConstant
protected abstract T newConstant(int id, java.lang.String name)
-
nextId
@Deprecated public final int nextId()
Deprecated.
-
-