Class ConstantPool<T extends Constant<T>>
java.lang.Object
com.swiftmq.impl.mqtt.v311.netty.util.ConstantPool<T>
- Type Parameters:
T
- the type of the constant
A pool of
Constant
s.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
protected abstract T
newConstant
(int id, String name) newInstance
(String name) Creates a newConstant
for the givenname
or fail with anIllegalArgumentException
if aConstant
for the givenname
exists.final int
nextId()
Deprecated.Returns theConstant
which is assigned to the specifiedname
.
-
Constructor Details
-
ConstantPool
public ConstantPool()
-
-
Method Details
-
valueOf
-
valueOf
Returns theConstant
which 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 samename
will always return the previously created one (i.e. singleton.)- Parameters:
name
- the name of theConstant
-
exists
-
newInstance
Creates a newConstant
for the givenname
or fail with anIllegalArgumentException
if aConstant
for the givenname
exists. -
newConstant
-
nextId
Deprecated.
-