Record Class Either.Right<L,R>
java.lang.Object
java.lang.Record
cloud.opencode.base.core.result.Either.Right<L,R>
- Type Parameters:
L- left type - 左类型R- right type - 右类型- Record Components:
value- right value - 右值
- All Implemented Interfaces:
Either<L,R>
Right - Represents the right case (typically success)
Right - 表示右情况(通常为成功)
- Since:
- JDK 25, opencode-base-core V1.0.3
- Author:
- Leon Soo www.LeonSoo.com
-
Nested Class Summary
Nested classes/interfaces inherited from interface Either
Either.Left<L,R>, Either.Right<L, R> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<L2,R2> Either <L2, R2> Transform both sides 转换两侧的值final booleanIndicates whether some other object is "equal to" this one.Transform the Right value to another Either 将 Right 值转换为另一个 Either<T> TFold both cases to a single result 将两种情况折叠为单一结果getLeft()Get the Left value if present 获取 Left 值(如果存在)Get Right value or default if Left 获取 Right 值或默认值(如果是 Left)getRight()Get the Right value if present 获取 Right 值(如果存在)final inthashCode()Returns a hash code value for this object.booleanisLeft()Check if this is a Left 检查是否为 LeftbooleanisRight()Check if this is a Right 检查是否为 RightTransform the Right value 转换 Right 值Transform the Left value 转换 Left 值Return this or other Either if Left 返回本 Either 或其他 Either(如果是 Left)Execute action on Right value 对 Right 值执行操作Execute action on Left value 对 Left 值执行操作stream()Convert to Stream.swap()Swap Left and Right 交换 Left 和 RightConvert to Optional.toResult()Convert to Result.Convert to Result with a type-safe left-to-throwable conversion function.toString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.
-
Constructor Details
-
Right
-
-
Method Details
-
isLeft
-
isRight
-
getLeft
-
getRight
-
map
Description copied from interface:EitherTransform the Right value 转换 Right 值 -
flatMap
Description copied from interface:EitherTransform the Right value to another Either 将 Right 值转换为另一个 Either -
mapLeft
Description copied from interface:EitherTransform the Left value 转换 Left 值 -
bimap
-
getOrElse
-
orElse
-
fold
-
swap
-
peek
-
peekLeft
-
toOptional
Description copied from interface:EitherConvert to Optional. Right value becomes Optional.of(value), Left becomes Optional.empty(). 转换为 Optional。Right 值变为 Optional.of(value),Left 变为 Optional.empty()。- Specified by:
toOptionalin interfaceEither<L,R> - Returns:
- Optional containing the Right value, or empty if Left
-
stream
Description copied from interface:EitherConvert to Stream. Right value becomes a single-element Stream, Left becomes an empty Stream. 转换为 Stream。Right 值变为单元素 Stream,Left 变为空 Stream。 -
toResult
Description copied from interface:EitherConvert to Result. Right becomes Result.success, Left(Throwable) becomes Result.failure, Left(other) becomes Result.failure(new OpenException(L.toString())). 转换为 Result。Right 变为 Result.success,Left(Throwable) 变为 Result.failure, Left(其他) 变为 Result.failure(new OpenException(L.toString()))。 -
toResult
Description copied from interface:EitherConvert to Result with a type-safe left-to-throwable conversion function. 使用类型安全的 left-to-throwable 转换函数转换为 Result。 -
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
-