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