Package com.mojang.serialization
Class DataResult<R>
java.lang.Object
com.mojang.serialization.DataResult<R>
- All Implemented Interfaces:
App<DataResult.Mu,
R>
- Mojang-Added Docs:
Represents either a successful operation, or a partial operation with an error message and a partial result (if available)
Also stores an additional lifecycle marker (monoidal)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static final class
static class
-
Method Summary
Modifier and TypeMethodDescriptionaddLifecycle
(Lifecycle lifecycle) <R2> DataResult<R2>
ap
(DataResult<Function<R, R2>> functionResult) <R2,
S> DataResult<S> apply2
(BiFunction<R, R2, S> function, DataResult<R2> second) <R2,
S> DataResult<S> apply2stable
(BiFunction<R, R2, S> function, DataResult<R2> second) <R2,
R3, S> DataResult<S> apply3
(Function3<R, R2, R3, S> function, DataResult<R2> second, DataResult<R3> third) boolean
error()
static <R> DataResult<R>
static <R> DataResult<R>
static <R> DataResult<R>
static <R> DataResult<R>
<R2> DataResult<R2>
flatMap
(Function<? super R, ? extends DataResult<R2>> function) get()
getOrThrow
(boolean allowPartial, Consumer<String> onError) int
hashCode()
static DataResult.Instance
instance()
<T> DataResult<T>
mapError
(UnaryOperator<String> function) static <K,
V> Function<K, DataResult<V>> partialGet
(Function<K, V> partialGet, Supplier<String> errorPrefix) promotePartial
(Consumer<String> onError) result()
resultOrPartial
(Consumer<String> onError) setLifecycle
(Lifecycle lifecycle) setPartial
(Supplier<R> partial) setPartial
(R partial) static <R> DataResult<R>
success
(R result) static <R> DataResult<R>
toString()
static <R> DataResult<R>
unbox
(App<DataResult.Mu, R> box)
-
Method Details
-
unbox
-
success
-
error
-
error
-
success
-
error
public static <R> DataResult<R> error(Supplier<String> message, R partialResult, Lifecycle lifecycle) -
error
-
partialGet
public static <K,V> Function<K,DataResult<V>> partialGet(Function<K, V> partialGet, Supplier<String> errorPrefix) -
get
-
result
-
lifecycle
-
resultOrPartial
-
getOrThrow
-
error
-
map
-
promotePartial
-
flatMap
- Mojang-Added Docs:
Applies the function to either full or partial result, in case of partial concatenates errors.
-
ap
-
apply2
-
apply2stable
-
apply3
public <R2,R3, DataResult<S> apply3S> (Function3<R, R2, R3, S> function, DataResult<R2> second, DataResult<R3> third) -
setPartial
-
setPartial
-
mapError
-
setLifecycle
-
addLifecycle
-
instance
-
equals
-
hashCode
public int hashCode() -
toString
-