mirror of
https://github.com/CarmJos/EasyConfiguration.git
synced 2026-06-04 10:38:19 +08:00
feat: Make function interface "serializable"
This commit is contained in:
@@ -2,8 +2,10 @@ package cc.carm.lib.configuration.function;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface DataConsumer<T> {
|
||||
public interface DataConsumer<T> extends Serializable {
|
||||
|
||||
void accept(@NotNull T data) throws Exception;
|
||||
|
||||
|
||||
@@ -4,10 +4,11 @@ package cc.carm.lib.configuration.function;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface DataFunction<T, R> {
|
||||
public interface DataFunction<T, R> extends Serializable {
|
||||
|
||||
@NotNull R handle(@NotNull T data) throws Exception;
|
||||
|
||||
|
||||
@@ -2,8 +2,10 @@ package cc.carm.lib.configuration.function;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface DataValidator<T> {
|
||||
public interface DataValidator<T> extends Serializable {
|
||||
|
||||
void validate(@Nullable T value) throws Exception;
|
||||
|
||||
|
||||
@@ -4,8 +4,10 @@ package cc.carm.lib.configuration.function;
|
||||
import cc.carm.lib.configuration.source.ConfigurationHolder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ValueComposer<T, U> {
|
||||
public interface ValueComposer<T, U> extends Serializable {
|
||||
|
||||
/**
|
||||
* Accept the value and the data, and then compose the value.
|
||||
|
||||
@@ -7,10 +7,11 @@ import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Objects;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ValueHandler<T, R> {
|
||||
public interface ValueHandler<T, R> extends Serializable {
|
||||
|
||||
@Nullable R handle(@NotNull ConfigurationHolder<?> holder, @NotNull T data) throws Exception;
|
||||
|
||||
|
||||
@@ -4,8 +4,10 @@ import cc.carm.lib.configuration.source.ConfigurationHolder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface ValueValidator<T> {
|
||||
public interface ValueValidator<T> extends Serializable {
|
||||
|
||||
void validate(@NotNull ConfigurationHolder<?> holder, @Nullable T value) throws Exception;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user