T
- type to extract from@FunctionalInterface public interface ToStringNullable<T> extends Expression<T>, ToNullable<T,String,ToString<T>>, HasHash<T>, HasCompare<T>, HasCompose<T>
String
value, or
null
. This expression can be implemented using a lambda, or it can be
a result of another operation. It has additional methods for operating on it.Function
Modifier and Type | Method and Description |
---|---|
String |
apply(T object) |
default int |
compare(T first,
T second) |
default <V> ToStringNullable<V> |
compose(Function<? super V,? extends T> before)
Returns a composed expression that first applies the
before
function to its input, and then applies this function to the result. |
default ExpressionType |
expressionType()
Returns the expression type of this expression.
|
default long |
hash(T object)
Hash the specified object into a 64-bit hash.
|
static <T> ToStringNullable<T> |
of(Function<T,String> lambda)
Returns a typed
ToStringNullable<T> using the provided
lambda . |
default ToString<T> |
orElse(String value)
Returns an equivalent expression as this, except that it will return
the
value if given an argument that would cause this
expression to return null . |
default ToString<T> |
orElseGet(ToString<T> getter)
Returns an equivalent expression as this, except that it will return
the
getter expression if given an argument that would cause this
expression to return null . |
default ToString<T> |
orThrow()
Returns an equivalent expression as this, except that it will throw a
NullPointerException if given an argument that would cause this
expression to return null . |
isNotNull, isNotNull, isNull, isNull
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
static <T> ToStringNullable<T> of(Function<T,String> lambda)
ToStringNullable<T>
using the provided
lambda
.T
- type to extract fromlambda
- to convertToStringNullable<T>
using the provided
lambda
NullPointerException
- if the provided lambda
is
null
default ExpressionType expressionType()
Expression
expressionType
in interface Expression<T>
default ToString<T> orThrow() throws NullPointerException
ToNullable
NullPointerException
if given an argument that would cause this
expression to return null
.orThrow
in interface ToNullable<T,String,ToString<T>>
NullPointerException
default ToString<T> orElseGet(ToString<T> getter)
ToNullable
getter
expression if given an argument that would cause this
expression to return null
.default ToString<T> orElse(String value)
ToNullable
value
if given an argument that would cause this
expression to return null
.default long hash(T object)
HasHash
default int compare(T first, T second)
compare
in interface Comparator<T>
compare
in interface HasCompare<T>
default <V> ToStringNullable<V> compose(Function<? super V,? extends T> before)
HasCompose
before
function to its input, and then applies this function to the result.
If evaluation of either function throws an exception, it is relayed to
the caller of the composed function.compose
in interface Function<T,String>
compose
in interface HasCompose<T>
V
- the type of input to the before
function, and to the
composed expressionbefore
- the function to apply before this function is appliedbefore
function and then applies this functionCopyright © 2018 Speedment, Inc.. All rights reserved.