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 
DataRegistrations. It's
 always advised to create a new builder with
 DataRegistration.builder() and calling reset() when
 re-using said builder.- 
Method SummaryModifier and TypeMethodDescriptionbuild()Gives theKeyto this builder signifying the key is to be registered either with an applicableDataProvideror an associatedDataStorethat will provide serialization/deserialization behaviors.Gives theKeyto this builder signifying the key is to be registered either with an applicableDataProvideror an associatedDataStorethat will provide serialization/deserialization behaviors.Gives theKeyto this builder signifying the key is to be registered either with an applicableDataProvideror an associatedDataStorethat will provide serialization/deserialization behaviors.provider(DataProvider<?, ?> provider) Gives the builder aDataProviderof 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 aDataStorethat will enable supporting serializing and de-serializingValues given a context of a specificDataHolderbyTypeToken.
- 
Method Details- 
storeGives the builder aDataStorethat will enable supporting serializing and de-serializingValues given a context of a specificDataHolderbyTypeToken. It is recommended that if theKeys are meant to be all grouped/controlled together, a singleDataStoreis to serialize/de-serialize any and allValuesfor 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
 
- 
providerGives the builder aDataProviderof which is registered for a particularKey. If aDataProvideralready exists for theKey, aDuplicateProviderExceptioncan be thrown.Note that by supplying a DataProvider, theValueswith the provider'sKeywill NOT be passed to any potentially registeredDataStoresfor serialization. AKeythat has aDataProviderwill 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
 
- 
dataKeyGives theKeyto this builder signifying the key is to be registered either with an applicableDataProvideror an associatedDataStorethat will provide serialization/deserialization behaviors. AKeyalone in the registration will allow for the understanding that theKey'sValuewill be constructed/provided for for variousDataHolders either through aDataProviderdynamically, or by a serialization strategy bya contextualized DataStore.- Parameters:
- key- The key to register
- Returns:
- This builder, for chaining
 
- 
dataKeyGives theKeyto this builder signifying the key is to be registered either with an applicableDataProvideror an associatedDataStorethat will provide serialization/deserialization behaviors. AKeyalone in the registration will allow for the understanding that theKey'sValuewill be constructed/provided for for variousDataHolders either through aDataProviderdynamically, or by a serialization strategy bya contextualized DataStore.- Parameters:
- key- The key to register
- others- The additional keys
- Returns:
- This builder, for chaining
 
- 
dataKeyGives theKeyto this builder signifying the key is to be registered either with an applicableDataProvideror an associatedDataStorethat will provide serialization/deserialization behaviors. AKeyalone in the registration will allow for the understanding that theKey'sValuewill be constructed/provided for for variousDataHolders either through aDataProviderdynamically, or by a serialization strategy bya contextualized DataStore.- Parameters:
- keys- The key to register
- Returns:
- This builder, for chaining
 
- 
resetDataRegistration.Builder reset()Description copied from interface:BuilderResets 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:
- resetin interface- Builder<DataRegistration,- DataRegistration.Builder> 
- Specified by:
- resetin interface- ResettableBuilder<DataRegistration,- DataRegistration.Builder> 
- Returns:
- This builder, for chaining
 
- 
buildDataRegistration build()- Specified by:
- buildin interface- AbstractBuilder<DataRegistration>
- Returns:
- The data registration object
- Throws:
- IllegalStateException- If registrations can no longer take place
- IllegalStateException- If there are no- Keys registered in this registration
- IllegalStateException- If there are no- DataProviders or- DataStores, resulting in the keys being dynamic
- DataAlreadyRegisteredException- If a key has already been claimed by another registration
 
 
-