public static interface DataRegistration.Builder<T extends DataManipulator<T,I>,I extends ImmutableDataManipulator<I,T>> extends CatalogBuilder<DataRegistration<T,I>,DataRegistration.Builder<T,I>>
id, name, name
<D extends DataManipulator<D,M>,M extends ImmutableDataManipulator<M,D>> DataRegistration.Builder<D,M> dataClass(Class<D> manipulatorClass)
DataManipulator
class to be used. For the sake of
generics, this method must be called prior to
immutableClass(Class)
to properly infer generic usage
by the compiler and at runtime.D
- The type of data manipulatorM
- The type of immutable data manipulatormanipulatorClass
- The manipulator classDataRegistration.Builder<T,I> immutableClass(Class<I> immutableDataClass) throws IllegalStateException
dataClass(Class)
!immutableDataClass
- The immutable data classIllegalStateException
- If the data manipulator class has not
been set alreadyDataRegistration.Builder<T,I> dataImplementation(Class<? extends T> dataImplementationClass) throws IllegalStateException
DataManipulator
. THIS MUST BE CALLED AFTER
dataClass(Class)
!dataImplementationClass
- The data manipulator implementationIllegalStateException
- If the data manipulator class has not
been set alreadyDataRegistration.Builder<T,I> immutableImplementation(Class<? extends I> immutableImplementationClass) throws IllegalStateException
ImmutableDataManipulator
. THIS MUST BE CALLED AFTER
dataClass(Class)
!immutableImplementationClass
- The immutable data manipulator
implementationIllegalStateException
- If the immutable data manipulator
class has not been set already@Deprecated default DataRegistration.Builder<T,I> manipulatorId(String id)
CatalogBuilder.id(String)
insteadCatalogType
standard:
{manipulator-id|
since the
"pluginid"
is gathered from buildAndRegister(PluginContainer)
provided
PluginContainer
.
The importance of the id is that the id is what will be used for serialization and deserialization of custom plugin provided data, such that if the string changes, or a plugin is no longer available to register the data, the custom data being deserialized will not be available through the system, and may be lost.
id
- The id for the manipulator@Deprecated default DataRegistration.Builder<T,I> dataName(String name)
CatalogBuilder.name(String)
insteadDataManipulator
as a common name.
As an example: if I have a DummyTestData, a name could be "Dummy".
name
- The data nameDataRegistration.Builder<T,I> builder(DataManipulatorBuilder<T,I> builder)
DataManipulatorBuilder
to be used to generate new
DataManipulators
and
ImmutableDataManipulators
.builder
- The builder@Deprecated DataRegistration.Builder<T,I> from(DataRegistration<T,I> value) throws UnsupportedOperationException
DataRegistration
objects should be considered
singletons in that the data registered upon creation is already
preformed, creating a new DataRegistration
will always
fail.from
in interface CatalogBuilder<DataRegistration<T extends DataManipulator<T,I>,I extends ImmutableDataManipulator<I,T>>,DataRegistration.Builder<T extends DataManipulator<T,I>,I extends ImmutableDataManipulator<I,T>>>
from
in interface ResettableBuilder<DataRegistration<T extends DataManipulator<T,I>,I extends ImmutableDataManipulator<I,T>>,DataRegistration.Builder<T extends DataManipulator<T,I>,I extends ImmutableDataManipulator<I,T>>>
value
- The built objectUnsupportedOperationException
- Always will throw an exception
since there can not be multiple registration objects for the same
dataDataRegistration.Builder<T,I> reset()
ResettableBuilder
reset
in interface ResettableBuilder<DataRegistration<T extends DataManipulator<T,I>,I extends ImmutableDataManipulator<I,T>>,DataRegistration.Builder<T extends DataManipulator<T,I>,I extends ImmutableDataManipulator<I,T>>>
@Deprecated default DataRegistration<T,I> buildAndRegister(PluginContainer container) throws IllegalStateException, IllegalArgumentException, DataAlreadyRegisteredException
build()
insteadDataRegistration
object, including the registration's
DataRegistration.getManipulatorClass()
for the
DataManipulator
and
DataRegistration.getImmutableManipulatorClass()
and DataRegistration.getDataManipulatorBuilder()
object. More
importantly, this also allows the proper identification of the
DataManipulator
itself by the provided
DataRegistration.getId()
,
which, much like CatalogType.getId()
is formatted with
{plugin-id|:{manipulator-id|
.
It is expected that as the required PluginContainer
is used
is not a default container from Sponge. The
PluginContainer.getId()
is utilized to generate the final
DataRegistration.getId()
for serialization purposes.
IllegalStateException
- If registrations can no longer
take placeIllegalArgumentException
- Various reasonsDataAlreadyRegisteredException
- If the classes and or builder
has already been registeredDataRegistration<T,I> build()
CatalogType
of type C
.
The last PluginContainer
in the cause stack will be used to
determine which plugin was used to construct the CatalogType
.
DataRegistration
object, including the registration's
DataRegistration.getManipulatorClass()
for the
DataManipulator
and
DataRegistration.getImmutableManipulatorClass()
and DataRegistration.getDataManipulatorBuilder()
object will also be registered.build
in interface CatalogBuilder<DataRegistration<T extends DataManipulator<T,I>,I extends ImmutableDataManipulator<I,T>>,DataRegistration.Builder<T extends DataManipulator<T,I>,I extends ImmutableDataManipulator<I,T>>>
IllegalStateException
- If registrations can no longer take placeIllegalArgumentException
- Various reasonsDataAlreadyRegisteredException
- If the classes and or builder
has already been registered