Package net.citizensnpcs.api.persistence
Annotation Type Persist
A marker annotation for
PersistenceLoader
to persist a field by saving and loading it into DataKey
s.-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionClass
<?> The specialised collection type to use when a super class is specified.Class
<?> The specific key type to use when deserialising Map keys from storage.If using global/static persistence, must be non-empty.boolean
Whether to use PersistenceLoader to load/save the value of this class.boolean
Whether a value must be present at load time.The DataKey path to use when saving/loading.Class
<?> The specific value type to use when deserialising values from storage.
-
Element Details
-
collectionType
Class<?> collectionTypeThe specialised collection type to use when a super class is specified. Eg. WeakHashMap.class when the field type is Map.- Default:
java.util.Collection.class
-
keyType
Class<?> keyTypeThe specific key type to use when deserialising Map keys from storage. Only supports primitive values and UUIDs currently.- Default:
java.lang.String.class
-
namespace
String namespaceIf using global/static persistence, must be non-empty.- Default:
""
-
reify
boolean reifyWhether to use PersistenceLoader to load/save the value of this class.- Default:
false
-
required
boolean requiredWhether a value must be present at load time. If a value for the field could not be loaded,PersistenceLoader.load(Object, DataKey)
will return null.- Default:
false
-
value
String valueThe DataKey path to use when saving/loading. If not present, the field name will be used instead.@Persist
-> root key + field name@Persist("")
-> root key + "" (i.e. just the root key)@Persist("sub")
root key + "sub"@Persist("$key")
loads the root key, does not save
- Default:
"UNINITIALISED"
-
valueType
Class<?> valueTypeThe specific value type to use when deserialising values from storage. Most useful when using specific number types e.g. Long, Byte, Short but storing as Integer.- Default:
java.lang.Object.class
-