Class AbstractDataBuilder<T extends DataSerializable>
java.lang.Object
org.spongepowered.api.data.persistence.AbstractDataBuilder<T>
- Type Parameters:
- T- The type of DataSerializable
- All Implemented Interfaces:
- DataBuilder<T>
- Direct Known Subclasses:
- Color.Builder,- RespawnLocation.Builder
public abstract class AbstractDataBuilder<T extends DataSerializable>
extends Object
implements DataBuilder<T>
An abstract implementation of 
DataBuilder that pre-defines all of
 the necessary "content update" implementation required for content
 versioning. Note that the builder itself is versioned to ensure that
 content versioning is appropriately handled. It is highly recommended to
 extend this class to implement DataBuilder and implement
 DataContentUpdaters as necessary for future upgradeability of
 custom content.- 
Constructor SummaryConstructorsModifierConstructorDescriptionprotectedAbstractDataBuilder(Class<T> requiredClass, int supportedVersion) 
- 
Method SummaryModifier and TypeMethodDescriptionAttempts to build the providedDataSerializablefrom the givenDataView.buildContent(DataView container) Builds the currentlysupportedVersionvariant of the intendedDataSerializable, such that all content upgrades have already been handled bybuild(DataView).
- 
Constructor Details- 
AbstractDataBuilder
 
- 
- 
Method Details- 
buildContentBuilds the currentlysupportedVersionvariant of the intendedDataSerializable, such that all content upgrades have already been handled bybuild(DataView). This otherwise follows the same contract asDataBuilder.build(DataView).- Parameters:
- container- The container with data to build from
- Returns:
- The deserialized data serializable, if possible
- Throws:
- InvalidDataException- If there's issues of invalid data formats or invalid data
 
- 
buildDescription copied from interface:DataBuilderAttempts to build the providedDataSerializablefrom the givenDataView. If theDataViewis invalid or missing necessary information to complete building theDataSerializable,Optional.empty()may be returned.- Specified by:
- buildin interface- DataBuilder<T extends DataSerializable>
- Parameters:
- container- The container containing all necessary data
- Returns:
- The instance of the DataSerializable, if successful
- Throws:
- InvalidDataException- In the event that the builder is unable to properly construct the data serializable from the data view
 
 
-