Top Description Fields Constructors Methods
io.r2dbc.spi

pack-priv abstract Class ConstantPool<T>

extends Object
Class Inheritance
Type Parameters
<T>
the type of the constant
Imports
java.util.concurrent.ConcurrentHashMap, .ConcurrentMap

A pool of constant instances. Only a single instance of each constant (by name) should ever exist.

Field Summary

Modifier and TypeField and Description
private final ConcurrentMap<String, T>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv abstract T

Returns:

a new instance of the constant
createConstant
(String
the name of the constant
name
,
boolean
whether the value represented by this constant is sensitive
sensitive
)

Creates a new instance of the constant.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
pack-priv final T

Returns:

a cached or newly created instance of a constant
valueOf
(String
the name of the constant
name
,
boolean
whether the value represented by this constant is sensitive
sensitive
)

Returns a cached or newly created instance of a constant.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

constantsback to summary
private final ConcurrentMap<String, T> constants

Constructor Detail

ConstantPoolback to summary
pack-priv ConstantPool()

Method Detail

createConstantback to summary
pack-priv abstract T createConstant(String name, boolean sensitive)

Creates a new instance of the constant. Implementations of this method should return a new instance each time.

Parameters
name:String

the name of the constant

sensitive:boolean

whether the value represented by this constant is sensitive

Returns:T

a new instance of the constant

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
valueOfback to summary
pack-priv final T valueOf(String name, boolean sensitive)

Returns a cached or newly created instance of a constant.

Parameters
name:String

the name of the constant

sensitive:boolean

whether the value represented by this constant is sensitive

Returns:T

a cached or newly created instance of a constant

Exceptions
IllegalArgumentException:
if name is null or empty