Package me.hsgamer.topper.value.core
Class ValueWrapper<T>
- java.lang.Object
-
- me.hsgamer.topper.value.core.ValueWrapper<T>
-
public final class ValueWrapper<T> extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classValueWrapper.State
-
Field Summary
Fields Modifier and Type Field Description @NotNull StringerrorMessage@NotNull ValueWrapper.Statestate@Nullable ThrowablethrowableTvalue
-
Constructor Summary
Constructors Constructor Description ValueWrapper(@NotNull ValueWrapper.State state, T value, @NotNull String errorMessage, @Nullable Throwable throwable)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<T>asOptional()Optional<T>asOptional(BiConsumer<@NotNull String,@Nullable Throwable> errorConsumer)static <T> ValueWrapper<T>copyNullWrapper(@NotNull ValueWrapper<?> wrapper)static <T> ValueWrapper<T>error(@NotNull String errorMessage)static <T> ValueWrapper<T>error(@NotNull String errorMessage, @NotNull Throwable throwable)static <T> ValueWrapper<T>error(@NotNull Throwable throwable)static <T> ValueWrapper<T>handled(T value)booleanisHandled()booleanisNull()static <T> ValueWrapper<T>notHandled()
-
-
-
Field Detail
-
state
@NotNull public final @NotNull ValueWrapper.State state
-
value
@Nullable public final T value
-
errorMessage
@NotNull public final @NotNull String errorMessage
-
throwable
@Nullable public final @Nullable Throwable throwable
-
-
Constructor Detail
-
ValueWrapper
public ValueWrapper(@NotNull @NotNull ValueWrapper.State state, @Nullable T value, @NotNull @NotNull String errorMessage, @Nullable @Nullable Throwable throwable)
-
-
Method Detail
-
handled
public static <T> ValueWrapper<T> handled(@Nullable T value)
-
notHandled
public static <T> ValueWrapper<T> notHandled()
-
error
public static <T> ValueWrapper<T> error(@NotNull @NotNull String errorMessage)
-
error
public static <T> ValueWrapper<T> error(@NotNull @NotNull Throwable throwable)
-
error
public static <T> ValueWrapper<T> error(@NotNull @NotNull String errorMessage, @NotNull @NotNull Throwable throwable)
-
copyNullWrapper
public static <T> ValueWrapper<T> copyNullWrapper(@NotNull @NotNull ValueWrapper<?> wrapper)
-
isHandled
public boolean isHandled()
-
isNull
public boolean isNull()
-
asOptional
public Optional<T> asOptional(BiConsumer<@NotNull String,@Nullable Throwable> errorConsumer)
-
-