Skip to content

Commit

Permalink
chore: just return single boolean or EntityCachedPlayerModel referenc…
Browse files Browse the repository at this point in the history
…es without ValueObjectDataResult usage
  • Loading branch information
aivruu committed Jan 30, 2024
1 parent 7a18e08 commit fe99edc
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions api/src/main/java/com/aivruu/homes/shared/DataModel.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.aivruu.homes.shared;

import com.aivruu.homes.player.EntityCachedPlayerModel;
import com.aivruu.homes.result.ValueObjectDataResult;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

Expand All @@ -16,7 +15,8 @@
*/
public interface DataModel {
/**
* Used to perform async operations for plugin data handling.
* Used to perform async operations
* for plugin data handling.
*
* @since 0.0.1
*/
Expand All @@ -33,28 +33,31 @@ public interface DataModel {
/**
* Unloads the storage for this implementation.
*
* @return A {@link CompletableFuture} with a boolean status.
* @return A {@link CompletableFuture} that provide a
* boolean status for this operation.
* @since 0.0.1
*/
@NotNull CompletableFuture<@NotNull Boolean> performUnload();

/**
* Writes the {@link EntityCachedPlayerModel} data into JSON file expected for this model.
* Saves the player model data into the plugin storage.
*
* @param playerModel {@link EntityCachedPlayerModel} needed to perform writing.
* @return A {@link CompletableFuture} that provide a {@link ValueObjectDataResult} with an
* expected status code for this operation, possible status codes.
* @return A {@link CompletableFuture} that provide a
* boolean status for this operation.
* @since 0.0.1
*/
@NotNull CompletableFuture<@NotNull ValueObjectDataResult<@Nullable EntityCachedPlayerModel>> performAsyncWrite(final @NotNull EntityCachedPlayerModel playerModel);
@NotNull CompletableFuture<@NotNull Boolean> performAsyncWrite(final @NotNull EntityCachedPlayerModel playerModel);

/**
* Reads the {@link EntityCachedPlayerModel} data from JSON file expected for this model data.
* Reads the player model data and
* create a new entity cached player model.
*
* @param name player name needed to find and read model file.
* @return A {@link CompletableFuture} that provide a {@link ValueObjectDataResult} with an
* expected status code for this operation, possible status codes.
* @return A {@link CompletableFuture} that provide a
* {@link EntityCachedPlayerModel} or {@code null}
* if there aren't data about the player.
* @since 0.0.1
*/
@NotNull CompletableFuture<@NotNull ValueObjectDataResult<@Nullable EntityCachedPlayerModel>> performAsyncRead(final @NotNull String name);
@NotNull CompletableFuture<@Nullable EntityCachedPlayerModel> performAsyncRead(final @NotNull String name);
}

0 comments on commit fe99edc

Please sign in to comment.