Package org.bukkit.persistence
Class PersistentDataType.BooleanPersistentDataType
java.lang.Object
org.bukkit.persistence.PersistentDataType.BooleanPersistentDataType
- All Implemented Interfaces:
PersistentDataType<Byte,
Boolean>
- Enclosing interface:
- PersistentDataType<T,
Z>
public static class PersistentDataType.BooleanPersistentDataType
extends Object
implements PersistentDataType<Byte,Boolean>
A convenience implementation to convert between Byte and Boolean as there is
no native implementation for booleans.
Any byte value not equal to 0 is considered to be true.
Any byte value not equal to 0 is considered to be true.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bukkit.persistence.PersistentDataType
PersistentDataType.BooleanPersistentDataType, PersistentDataType.PrimitivePersistentDataType<T>
-
Field Summary
Fields inherited from interface org.bukkit.persistence.PersistentDataType
BOOLEAN, BYTE, BYTE_ARRAY, DOUBLE, FLOAT, INTEGER, INTEGER_ARRAY, LONG, LONG_ARRAY, SHORT, STRING, TAG_CONTAINER, TAG_CONTAINER_ARRAY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfromPrimitive
(Byte primitive, 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
(Boolean complex, PersistentDataAdapterContext context) Returns the primitive data that resembles the complex object passed to this method.
-
Constructor Details
-
BooleanPersistentDataType
public BooleanPersistentDataType()
-
-
Method Details
-
getPrimitiveType
Description copied from interface:PersistentDataType
Returns the primitive data type of this tag.- Specified by:
getPrimitiveType
in interfacePersistentDataType<Byte,
Boolean> - Returns:
- the class
-
getComplexType
Description copied from interface:PersistentDataType
Returns the complex object type the primitive value resembles.- Specified by:
getComplexType
in interfacePersistentDataType<Byte,
Boolean> - Returns:
- the class type
-
toPrimitive
@NotNull public Byte toPrimitive(@NotNull Boolean 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 interfacePersistentDataType<Byte,
Boolean> - Parameters:
complex
- the complex object instancecontext
- the context this operation is running in- Returns:
- the primitive value
-
fromPrimitive
@NotNull public Boolean fromPrimitive(@NotNull Byte primitive, @NotNull PersistentDataAdapterContext context) Description copied from interface:PersistentDataType
Creates a complex object based of the passed primitive value- Specified by:
fromPrimitive
in interfacePersistentDataType<Byte,
Boolean> - Parameters:
primitive
- the primitive valuecontext
- the context this operation is running in- Returns:
- the complex object instance
-