Class PersistentDataType.PrimitivePersistentDataType<P>

java.lang.Object
org.bukkit.persistence.PersistentDataType.PrimitivePersistentDataType<P>
Type Parameters:
P - the generic type of the primitive objects
All Implemented Interfaces:
PersistentDataType<P,P>
Enclosing interface:
PersistentDataType<P,C>

public static class PersistentDataType.PrimitivePersistentDataType<P> extends Object implements PersistentDataType<P,P>
A default implementation that simply exists to pass on the retrieved or inserted value to the next layer.

This implementation does not add any kind of logic, but is used to provide default implementations for the primitive types.

  • Method Details

    • getPrimitiveType

      @NotNull public Class<P> getPrimitiveType()
      Description copied from interface: PersistentDataType
      Returns the primitive data type of this tag.
      Specified by:
      getPrimitiveType in interface PersistentDataType<P,P>
      Returns:
      the class
    • getComplexType

      @NotNull public Class<P> getComplexType()
      Description copied from interface: PersistentDataType
      Returns the complex object type the primitive value resembles.
      Specified by:
      getComplexType in interface PersistentDataType<P,P>
      Returns:
      the class type
    • toPrimitive

      @NotNull public P toPrimitive(@NotNull P complex, @NotNull PersistentDataAdapterContext context)
      Description copied from interface: PersistentDataType
      Returns the primitive data that resembles the complex object passed to this method.
      Specified by:
      toPrimitive in interface PersistentDataType<P,P>
      Parameters:
      complex - the complex object instance
      context - the context this operation is running in
      Returns:
      the primitive value
    • fromPrimitive

      @NotNull public P fromPrimitive(@NotNull P primitive, @NotNull PersistentDataAdapterContext context)
      Description copied from interface: PersistentDataType
      Creates a complex object based of the passed primitive value
      Specified by:
      fromPrimitive in interface PersistentDataType<P,P>
      Parameters:
      primitive - the primitive value
      context - the context this operation is running in
      Returns:
      the complex object instance