Package net.tnemc.item.persistent
Class PersistentDataType<T>
java.lang.Object
net.tnemc.item.persistent.PersistentDataType<T>
- Direct Known Subclasses:
PersistentBool,PersistentByte,PersistentByteArray,PersistentDouble,PersistentFloat,PersistentInt,PersistentIntArray,PersistentLong,PersistentLongArray,PersistentShort,PersistentString
PersistentDataType
- Since:
- 0.2.0.0
- Author:
- creatorfromhell
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract TDecodes the given encoded string and sets the decoded value.abstract Stringencode()Encodes the value of the PersistentDataType into a string representation.voidreadJSON(JSONHelper json) Decodes theJSON objectand sets the values in the current instance.org.json.simple.JSONObjecttoJSON()abstract Stringtype()Returns the type of the PersistentDataType.
-
Constructor Details
-
PersistentDataType
-
-
Method Details
-
identifier
-
type
Returns the type of the PersistentDataType.- Returns:
- The type of the PersistentDataType as a String.
- Since:
- 0.2.0.0
-
encode
Encodes the value of the PersistentDataType into a string representation.- Returns:
- The encoded string representation of the value
- Since:
- 0.2.0.0
-
decode
Decodes the given encoded string and sets the decoded value.- Parameters:
encoded- The string to be decoded- Returns:
- The decoded value of type T
- Throws:
IllegalArgumentException- if the encoded string is invalid- Since:
- 0.2.0.0
-
readJSON
Decodes theJSON objectand sets the values in the current instance.- Parameters:
json- TheJSON objectto be decoded- Since:
- 0.2.0.0
-
toJSON
-