SCALAR - The type of scalar.public class OptionalScalar<SCALAR> extends BaseOptional<SCALAR>
| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected static OptionalScalar<Object> |
EMPTY_INSTANCE |
protected static OptionalThingExceptionThrower |
NOWAY_THROWER |
_obj, _thrower, IF_PRESENT_AFTER_EMPTY, IF_PRESENT_AFTER_NONE_FIRE| コンストラクタと説明 |
|---|
OptionalScalar(SCALAR thing,
OptionalThingExceptionThrower thrower) |
| 修飾子とタイプ | メソッドと説明 |
|---|---|
void |
alwaysPresent(OptionalThingConsumer<SCALAR> oneArgLambda)
Handle the thing in the optional thing or exception if not present.
|
protected void |
assertOneArgLambdaNotNull(Object oneArgLambda) |
protected <ARG> OptionalScalar<ARG> |
createOptionalFilteredObject(ARG obj) |
protected <ARG> OptionalScalar<ARG> |
createOptionalFlatMappedObject(ARG obj) |
protected <ARG> OptionalScalar<ARG> |
createOptionalMappedObject(ARG obj) |
static <EMPTY> OptionalScalar<EMPTY> |
empty() |
OptionalScalar<SCALAR> |
filter(OptionalThingPredicate<SCALAR> oneArgLambda)
Filter the thing by the predicate.
|
<RESULT> OptionalThing<RESULT> |
flatMap(OptionalThingFunction<? super SCALAR,OptionalThing<RESULT>> oneArgLambda)
Apply the flat-mapping of thing to result thing.
|
SCALAR |
get()
Get the thing or exception if null.
|
OptionalThingIfPresentAfter |
ifPresent(OptionalThingConsumer<SCALAR> oneArgLambda)
Handle the wrapped thing if it is present.
|
boolean |
isPresent()
Is the object instance present?
|
<RESULT> OptionalThing<RESULT> |
map(OptionalThingFunction<? super SCALAR,? extends RESULT> oneArgLambda)
Apply the mapping of thing to result thing.
|
static <OBJ> OptionalScalar<OBJ> |
of(OBJ object) |
static <OBJ> OptionalScalar<OBJ> |
ofNullable(OBJ object,
OptionalThingExceptionThrower noArgLambda) |
SCALAR |
orElse(SCALAR other)
Get the wrapped instance or returns the specified thing.
|
SCALAR |
orElseGet(OptionalThingSupplier<SCALAR> noArgLambda)
Get the thing or get from the supplier.
|
SCALAR |
orElseNull()
非推奨です。
basically use ifPresent() or use orElse(null)
|
<CAUSE extends Throwable> |
orElseThrow(OptionalThingSupplier<? extends CAUSE> noArgLambda)
Get the thing or throw the exception.
|
callbackAlwaysPresent, callbackFilter, callbackFlatMapping, callbackIfPresent, callbackMapping, directlyGet, directlyGetOrElse, directlyGetOrElseGet, directlyGetOrElseThrow, equals, exists, hashCode, toOptional, toStringprotected static final OptionalScalar<Object> EMPTY_INSTANCE
protected static final OptionalThingExceptionThrower NOWAY_THROWER
public OptionalScalar(SCALAR thing, OptionalThingExceptionThrower thrower)
thing - The wrapped instance of thing. (NullAllowed)thrower - The exception thrower when illegal access. (NotNull)public static <EMPTY> OptionalScalar<EMPTY> empty()
EMPTY - The type of empty optional scalar.public static <OBJ> OptionalScalar<OBJ> of(OBJ object)
OBJ - The type of object wrapped in the optional scalar.object - The wrapped thing which is optional. (NotNull)public static <OBJ> OptionalScalar<OBJ> ofNullable(OBJ object, OptionalThingExceptionThrower noArgLambda)
OBJ - The type of object wrapped in the optional scalar.object - The wrapped instance or thing. (NullAllowed)noArgLambda - The callback for exception when illegal access. (NotNull)public OptionalThingIfPresentAfter ifPresent(OptionalThingConsumer<SCALAR> oneArgLambda)
oneArgLambda - The callback interface to consume the optional thing. (NotNull)public boolean isPresent()
public SCALAR get()
public OptionalScalar<SCALAR> filter(OptionalThingPredicate<SCALAR> oneArgLambda)
oneArgLambda - The callback to predicate whether the object is remained. (NotNull)protected <ARG> OptionalScalar<ARG> createOptionalFilteredObject(ARG obj)
createOptionalFilteredObject クラス内 BaseOptional<SCALAR>ARG - The type of value for optional thing.obj - The plain object for the optional thing. (NullAllowed: if null, return s empty optional)public <RESULT> OptionalThing<RESULT> map(OptionalThingFunction<? super SCALAR,? extends RESULT> oneArgLambda)
RESULT - The type of mapping result.oneArgLambda - The callback interface to apply, null return allowed as empty. (NotNull)protected <ARG> OptionalScalar<ARG> createOptionalMappedObject(ARG obj)
createOptionalMappedObject クラス内 BaseOptional<SCALAR>ARG - The type of value for optional thing.obj - The plain object for the optional thing. (NullAllowed: if null, return s empty optional)public <RESULT> OptionalThing<RESULT> flatMap(OptionalThingFunction<? super SCALAR,OptionalThing<RESULT>> oneArgLambda)
RESULT - The type of mapping result.oneArgLambda - The callback interface to apply, cannot return null. (NotNull)protected <ARG> OptionalScalar<ARG> createOptionalFlatMappedObject(ARG obj)
createOptionalFlatMappedObject クラス内 BaseOptional<SCALAR>ARG - The type of value for optional thing.obj - The plain object for the optional thing. (NullAllowed: if null, return s empty optional)public SCALAR orElse(SCALAR other)
other - The object instance to be returned when the optional is empty. (NullAllowed)public SCALAR orElseGet(OptionalThingSupplier<SCALAR> noArgLambda)
noArgLambda - The supplier of other instance if null. (NotNull)public <CAUSE extends Throwable> SCALAR orElseThrow(OptionalThingSupplier<? extends CAUSE> noArgLambda) throws CAUSE extends Throwable
CAUSE - The type of cause.noArgLambda - The supplier of exception if null. (NotNull)CAUSE - When the value is null.CAUSE extends Throwablepublic void alwaysPresent(OptionalThingConsumer<SCALAR> oneArgLambda)
oneArgLambda - The callback interface to consume the optional thing. (NotNull)public SCALAR orElseNull()
protected void assertOneArgLambdaNotNull(Object oneArgLambda)
Copyright © 2014–2015 The DBFlute Project. All rights reserved.