-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
682 additions
and
117 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
eco-api/src/main/java/com/willfp/eco/core/data/handlers/DataTypeSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.willfp.eco.core.data.handlers; | ||
|
||
import com.willfp.eco.core.data.keys.PersistentDataKey; | ||
import com.willfp.eco.core.data.keys.PersistentDataKeyType; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.UUID; | ||
|
||
/** | ||
* Handles data read/write for a {@link com.willfp.eco.core.data.keys.PersistentDataKeyType} for a specific | ||
* data handler. | ||
*/ | ||
public abstract class DataTypeSerializer<T> { | ||
/** | ||
* Create a new data type serializer. | ||
*/ | ||
protected DataTypeSerializer() { | ||
|
||
} | ||
|
||
/** | ||
* Read a value. | ||
* | ||
* @param uuid The uuid. | ||
* @param key The key. | ||
* @return The value. | ||
*/ | ||
@Nullable | ||
public abstract T readAsync(@NotNull final UUID uuid, | ||
@NotNull final PersistentDataKey<T> key); | ||
|
||
/** | ||
* Write a value. | ||
* | ||
* @param uuid The uuid. | ||
* @param key The key. | ||
* @param value The value. | ||
*/ | ||
public abstract void writeAsync(@NotNull final UUID uuid, | ||
@NotNull final PersistentDataKey<T> key, | ||
@NotNull final T value); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.