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 T
Decodes the given encoded string and sets the decoded value.abstract String
encode()
Encodes the value of the PersistentDataType into a string representation.void
readJSON
(JSONHelper json) Decodes theJSON object
and sets the values in the current instance.org.json.simple.JSONObject
toJSON()
abstract String
type()
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 object
and sets the values in the current instance.- Parameters:
json
- TheJSON object
to be decoded- Since:
- 0.2.0.0
-
toJSON
-