Package org.bukkit.persistence
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.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bukkit.persistence.PersistentDataType
PersistentDataType.BooleanPersistentDataType, PersistentDataType.PrimitivePersistentDataType<P>
-
Field Summary
Fields inherited from interface org.bukkit.persistence.PersistentDataType
BOOLEAN, BYTE, BYTE_ARRAY, DOUBLE, FLOAT, INTEGER, INTEGER_ARRAY, LIST, LONG, LONG_ARRAY, SHORT, STRING, TAG_CONTAINER, TAG_CONTAINER_ARRAY
-
Method Summary
Modifier and TypeMethodDescriptionfromPrimitive
(P primitive, @NotNull PersistentDataAdapterContext context) Creates a complex object based of the passed primitive valueReturns the complex object type the primitive value resembles.Returns the primitive data type of this tag.toPrimitive
(P complex, @NotNull PersistentDataAdapterContext context) Returns the primitive data that resembles the complex object passed to this method.
-
Method Details
-
getPrimitiveType
Description copied from interface:PersistentDataType
Returns the primitive data type of this tag.- Specified by:
getPrimitiveType
in interfacePersistentDataType<P,
P> - Returns:
- the class
-
getComplexType
Description copied from interface:PersistentDataType
Returns the complex object type the primitive value resembles.- Specified by:
getComplexType
in interfacePersistentDataType<P,
P> - Returns:
- the class type
-
toPrimitive
@NotNull public P toPrimitive(@NotNull P complex, @NotNull @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 interfacePersistentDataType<P,
P> - Parameters:
complex
- the complex object instancecontext
- the context this operation is running in- Returns:
- the primitive value
-
fromPrimitive
@NotNull public P fromPrimitive(@NotNull P primitive, @NotNull @NotNull PersistentDataAdapterContext context) Description copied from interface:PersistentDataType
Creates a complex object based of the passed primitive value- Specified by:
fromPrimitive
in interfacePersistentDataType<P,
P> - Parameters:
primitive
- the primitive valuecontext
- the context this operation is running in- Returns:
- the complex object instance
-