Record Class DataResult.Success<R>
java.lang.Object
java.lang.Record
com.mojang.serialization.DataResult.Success<R>
- All Implemented Interfaces:
App<DataResult.Mu, R>, DataResult<R>
- Enclosing interface:
DataResult<R>
public static record DataResult.Success<R>(R value, Lifecycle lifecycle)
extends Record
implements DataResult<R>
-
Nested Class Summary
Nested classes/interfaces inherited from interface DataResult
DataResult.Error<R>, DataResult.Instance, DataResult.Mu, DataResult.Success<R> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<R2> DataResult<R2> ap(DataResult<Function<R, R2>> functionResult) final booleanIndicates whether some other object is "equal to" this one.error()<R2> DataResult<R2> flatMap(Function<? super R, ? extends DataResult<R2>> function) Applies the function to either full or partial result, in case of partial concatenates errors.getOrThrow(Function<String, E> exceptionSupplier) getPartialOrThrow(Function<String, E> exceptionSupplier) final inthashCode()Returns a hash code value for this object.booleanifError(Consumer<? super DataResult.Error<R>> ifError) booleanReturns the value of thelifecyclerecord component.<T> DataResult<T> mapError(UnaryOperator<String> function) <T> TmapOrElse(Function<? super R, ? extends T> successFunction, Function<? super DataResult.Error<R>, ? extends T> errorFunction) promotePartial(Consumer<String> onError) result()resultOrPartial(Consumer<String> onError) setLifecycle(Lifecycle lifecycle) setPartial(Supplier<R> partial) setPartial(R partial) toString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.Methods inherited from interface DataResult
addLifecycle, apply2, apply2stable, apply3, getOrThrow, getPartialOrThrow, isError
-
Field Details
-
value
The field for thevaluerecord component. -
lifecycle
The field for thelifecyclerecord component.
-
-
Constructor Details
-
Success
-
-
Method Details
-
result
- Specified by:
resultin interfaceDataResult<R>
-
error
- Specified by:
errorin interfaceDataResult<R>
-
hasResultOrPartial
public boolean hasResultOrPartial()- Specified by:
hasResultOrPartialin interfaceDataResult<R>
-
resultOrPartial
- Specified by:
resultOrPartialin interfaceDataResult<R>
-
resultOrPartial
- Specified by:
resultOrPartialin interfaceDataResult<R>
-
getOrThrow
- Specified by:
getOrThrowin interfaceDataResult<R>- Throws:
E
-
getPartialOrThrow
- Specified by:
getPartialOrThrowin interfaceDataResult<R>- Throws:
E
-
map
- Specified by:
mapin interfaceDataResult<R>
-
mapOrElse
public <T> T mapOrElse(Function<? super R, ? extends T> successFunction, Function<? super DataResult.Error<R>, ? extends T> errorFunction) - Specified by:
mapOrElsein interfaceDataResult<R>
-
ifSuccess
- Specified by:
ifSuccessin interfaceDataResult<R>
-
ifError
- Specified by:
ifErrorin interfaceDataResult<R>
-
promotePartial
- Specified by:
promotePartialin interfaceDataResult<R>
-
flatMap
Description copied from interface:DataResultApplies the function to either full or partial result, in case of partial concatenates errors.- Specified by:
flatMapin interfaceDataResult<R>
-
ap
- Specified by:
apin interfaceDataResult<R>
-
setPartial
- Specified by:
setPartialin interfaceDataResult<R>
-
setPartial
- Specified by:
setPartialin interfaceDataResult<R>
-
mapError
- Specified by:
mapErrorin interfaceDataResult<R>
-
setLifecycle
- Specified by:
setLifecyclein interfaceDataResult<R>
-
isSuccess
public boolean isSuccess()- Specified by:
isSuccessin interfaceDataResult<R>
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
lifecycle
Returns the value of thelifecyclerecord component.- Specified by:
lifecyclein interfaceDataResult<R>- Returns:
- the value of the
lifecyclerecord component
-