Class PersistData<T,D>
java.lang.Object
io.github.vitalforge.persistlib.dataconversion.PersistData<T,D>
- Type Parameters:
T- The type of the self.D- The type of the data.
Represents data that can be persisted.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classCreates a new builder. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetData()Retrieves the data from the PersistData.@Nullable BooleangetFlag(PersistDataFlags key) Retrieves a flag from the data.booleangetFlag(PersistDataFlags key, boolean defaultValue) Retrieves a flag from the data.getSelf()Retrieves the self from the PersistData.setFlag(PersistDataFlags key, boolean value) Sets a flag on the data.
-
Constructor Details
-
PersistData
Creates a new instance of the PersistData.- Parameters:
self- The self to create the PersistData for.data- The data to create the PersistData for.
-
-
Method Details
-
setFlag
Sets a flag on the data.- Parameters:
key- The key of the flag to set.value- The value of the flag to set.- Returns:
- The current instance of the PersistData.
-
getFlag
Retrieves a flag from the data.- Parameters:
key- The key of the flag to retrieve.- Returns:
- The value of the flag, or null if the flag does not exist.
-
getFlag
Retrieves a flag from the data.- Parameters:
key- The key of the flag to retrieve.defaultValue- The default value to return if the flag does not exist.- Returns:
- The value of the flag, or the default value if the flag does not exist.
-
getData
Retrieves the data from the PersistData.- Returns:
- The data from the PersistData.
-
getSelf
Retrieves the self from the PersistData.- Returns:
- The self from the PersistData.
-