Package org.spongepowered.api.data
Interface DataRegistration.Builder
- All Superinterfaces:
AbstractBuilder<DataRegistration>
,Builder<DataRegistration,
,DataRegistration.Builder> ResettableBuilder<DataRegistration,
DataRegistration.Builder>
- Enclosing interface:
DataRegistration
public static interface DataRegistration.Builder
extends Builder<DataRegistration,DataRegistration.Builder>
A standard builder for constructing new
DataRegistration
s. It's
always advised to create a new builder with
DataRegistration.builder()
and calling reset()
when
re-using said builder.-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Gives theKey
to this builder signifying the key is to be registered either with an applicableDataProvider
or an associatedDataStore
that will provide serialization/deserialization behaviors.Gives theKey
to this builder signifying the key is to be registered either with an applicableDataProvider
or an associatedDataStore
that will provide serialization/deserialization behaviors.Gives theKey
to this builder signifying the key is to be registered either with an applicableDataProvider
or an associatedDataStore
that will provide serialization/deserialization behaviors.provider
(DataProvider<?, ?> provider) Gives the builder aDataProvider
of which is registered for a particularKey
.reset()
Resets this builder to a "default" state such that there is no remaining data to set.Gives the builder aDataStore
that will enable supporting serializing and de-serializingValue
s given a context of a specificDataHolder
byTypeToken
.
-
Method Details
-
store
Gives the builder aDataStore
that will enable supporting serializing and de-serializingValue
s given a context of a specificDataHolder
byTypeToken
. It is recommended that if theKey
s are meant to be all grouped/controlled together, a singleDataStore
is to serialize/de-serialize any and allValues
for thoseKeys
.- Parameters:
store
- The data store providing the serialization process- Returns:
- This builder, for chaining
- Throws:
DuplicateDataStoreException
- If the DataStore is already registered for the type token it uses
-
provider
Gives the builder aDataProvider
of which is registered for a particularKey
. If aDataProvider
already exists for theKey
, aDuplicateProviderException
can be thrown.Note that by supplying a
DataProvider
, theValues
with the provider'sKey
will NOT be passed to any potentially registeredDataStores
for serialization. AKey
that has aDataProvider
will always pass through thatDataProvider
, and never aDataStore
.- Parameters:
provider
- The provider- Returns:
- This builder, for chaining
- Throws:
DuplicateProviderException
- If there is already a DataProvider for the key
-
dataKey
Gives theKey
to this builder signifying the key is to be registered either with an applicableDataProvider
or an associatedDataStore
that will provide serialization/deserialization behaviors. AKey
alone in the registration will allow for the understanding that theKey's
Value
will be constructed/provided for for variousDataHolder
s either through aDataProvider
dynamically, or by a serialization strategy bya contextualized DataStore
.- Parameters:
key
- The key to register- Returns:
- This builder, for chaining
-
dataKey
Gives theKey
to this builder signifying the key is to be registered either with an applicableDataProvider
or an associatedDataStore
that will provide serialization/deserialization behaviors. AKey
alone in the registration will allow for the understanding that theKey's
Value
will be constructed/provided for for variousDataHolder
s either through aDataProvider
dynamically, or by a serialization strategy bya contextualized DataStore
.- Parameters:
key
- The key to registerothers
- The additional keys- Returns:
- This builder, for chaining
-
dataKey
Gives theKey
to this builder signifying the key is to be registered either with an applicableDataProvider
or an associatedDataStore
that will provide serialization/deserialization behaviors. AKey
alone in the registration will allow for the understanding that theKey's
Value
will be constructed/provided for for variousDataHolder
s either through aDataProvider
dynamically, or by a serialization strategy bya contextualized DataStore
.- Parameters:
keys
- The key to register- Returns:
- This builder, for chaining
-
reset
DataRegistration.Builder reset()Description copied from interface:Builder
Resets this builder to a "default" state such that there is no remaining data to set. This is to be the presumed "default" state.- Specified by:
reset
in interfaceBuilder<DataRegistration,
DataRegistration.Builder> - Specified by:
reset
in interfaceResettableBuilder<DataRegistration,
DataRegistration.Builder> - Returns:
- This builder, for chaining
-
build
DataRegistration build()- Specified by:
build
in interfaceAbstractBuilder<DataRegistration>
- Returns:
- The data registration object
- Throws:
IllegalStateException
- If registrations can no longer take placeIllegalStateException
- If there are noKey
s registered in this registrationIllegalStateException
- If there are noDataProvider
s orDataStore
s, resulting in the keys being dynamic
-