public final class OptionalUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static com.speedment.common.function.OptionalBoolean |
ofNullable(Boolean b)
Wraps the specified nullable value in an
OptionalBoolean. |
static OptionalDouble |
ofNullable(Double d)
Wraps the specified nullable value in an
OptionalDouble. |
static OptionalInt |
ofNullable(Integer i)
Wraps the specified nullable value in an
OptionalInteger. |
static OptionalLong |
ofNullable(Long l)
Wraps the specified nullable value in an
OptionalLong. |
static com.speedment.common.function.OptionalBoolean |
parseBoolean(String value)
Parses the specified value into an optional unless it is
null,
in which case an empty optional is returned. |
static OptionalDouble |
parseDouble(String value)
Parses the specified value into an optional unless it is
null,
in which case an empty optional is returned. |
static OptionalInt |
parseInt(String value)
Parses the specified value into an optional unless it is
null,
in which case an empty optional is returned. |
static OptionalLong |
parseLong(String value)
Parses the specified value into an optional unless it is
null,
in which case an empty optional is returned. |
static Object |
unwrap(Object potentiallyOptional)
If the specified object is an
Optional, the inner value will be
returned. |
static <T> T |
unwrap(Optional<T> optional)
Returns the inner value of the
Optional unless the optional
is null, in which case null is returned. |
static Boolean |
unwrap(com.speedment.common.function.OptionalBoolean optional)
Convert an optional value to a boxed one.
|
static Double |
unwrap(OptionalDouble optional)
Convert an optional value to a boxed one.
|
static Integer |
unwrap(OptionalInt optional)
Convert an optional value to a boxed one.
|
static Long |
unwrap(OptionalLong optional)
Convert an optional value to a boxed one.
|
public static Object unwrap(Object potentiallyOptional)
Optional, the inner value will be
returned. Otherwise, the object is returned directly.potentiallyOptional - the object that might be an Optionalpublic static <T> T unwrap(Optional<T> optional)
Optional unless the optional
is null, in which case null is returned.T - the inner typeoptional - the optionalnullpublic static Integer unwrap(OptionalInt optional)
null will be returned.optional - the optional value (or null)nullpublic static Boolean unwrap(com.speedment.common.function.OptionalBoolean optional)
null will be returned.optional - the optional value (or null)nullpublic static Long unwrap(OptionalLong optional)
null will be returned.optional - the optional value (or null)nullpublic static Double unwrap(OptionalDouble optional)
null will be returned.optional - the optional value (or null)nullpublic static OptionalLong ofNullable(Long l)
OptionalLong.l - the valuepublic static OptionalInt ofNullable(Integer i)
OptionalInteger.i - the valuepublic static OptionalDouble ofNullable(Double d)
OptionalDouble.d - the valuepublic static com.speedment.common.function.OptionalBoolean ofNullable(Boolean b)
OptionalBoolean.b - the valuepublic static OptionalLong parseLong(String value)
null,
in which case an empty optional is returned.value - the value (or null)public static OptionalInt parseInt(String value)
null,
in which case an empty optional is returned.value - the value (or null)public static OptionalDouble parseDouble(String value)
null,
in which case an empty optional is returned.value - the value (or null)public static com.speedment.common.function.OptionalBoolean parseBoolean(String value)
null,
in which case an empty optional is returned.value - the value (or null)Copyright © 2019 Speedment, Inc.. All rights reserved.