Interface PersistentDataType<P,C>

Type Parameters:
P - the primary object type that is stored in the given tag
C - the retrieved object type when applying this tag type
All Known Subinterfaces:
All Known Implementing Classes:
PersistentDataType.BooleanPersistentDataType, PersistentDataType.PrimitivePersistentDataType

public interface PersistentDataType<P,C>
This class represents an enum with a generic content type. It defines the types a custom tag can have.

This interface can be used to create your own custom PersistentDataType with different complex types. This may be useful for the likes of a UUIDTagType:

 public class UUIDTagType implements PersistentDataType<byte[], UUID> {

         public Class<byte[]> getPrimitiveType() {
             return byte[].class;

         public Class<UUID> getComplexType() {
             return UUID.class;

         public byte[] toPrimitive(UUID complex, PersistentDataAdapterContext context) {
             ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
             return bb.array();

         public UUID fromPrimitive(byte[] primitive, PersistentDataAdapterContext context) {
             ByteBuffer bb = ByteBuffer.wrap(primitive);
             long firstLong = bb.getLong();
             long secondLong = bb.getLong();
             return new UUID(firstLong, secondLong);
Any plugin owned implementation of this interface is required to define one of the existing primitive types found in this interface. Notably BOOLEAN is not a primitive type but a convenience type.