T
- type to extract from@FunctionalInterface public interface ToBoolean<T> extends Expression<T>, com.speedment.common.function.ToBooleanFunction<T>, HasAsDouble<T>, HasAsInt<T>, HasAsLong<T>, HasMap<T,com.speedment.common.function.BooleanUnaryOperator,ToBoolean<T>>, HasMapToDouble<T,com.speedment.common.function.BooleanToDoubleFunction>, HasHash<T>, HasCompare<T>, HasCompose<T>
boolean
value. 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.ToBooleanFunction
,
Predicate
Modifier and Type | Method and Description |
---|---|
boolean |
applyAsBoolean(T object)
Applies this function to the given argument.
|
default ToDouble<T> |
asDouble()
Returns an expression that casts the result of the current expression
into a
double . |
default ToInt<T> |
asInt()
Returns an expression that casts the result of the current expression
into an
int . |
default ToLong<T> |
asLong()
Returns an expression that casts the result of the current expression
into a
long . |
default int |
compare(T first,
T second) |
default <V> ToBoolean<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 <V> ToBooleanNullable<V> |
composeNullable(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.
|
default ToBoolean<T> |
map(com.speedment.common.function.BooleanUnaryOperator operator)
Returns an expression for the value of this expression mapped using the
specified mapping function.
|
default ToDouble<T> |
mapToDouble(com.speedment.common.function.BooleanToDoubleFunction operator)
Maps the result of this expression into a
double by passing it to
the specified mapper , producing a new expression that implements
ToDouble . |
static <T> ToBoolean<T> |
of(Predicate<T> lambda)
Returns a typed
ToBoolean<T> using the provided lambda . |
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
static <T> ToBoolean<T> of(Predicate<T> lambda)
ToBoolean<T>
using the provided lambda
.T
- type to extract fromlambda
- to convertToBoolean<T>
using the provided lambda
NullPointerException
- if the provided lambda
is
null
boolean applyAsBoolean(T object)
com.speedment.common.function.ToBooleanFunction
applyAsBoolean
in interface com.speedment.common.function.ToBooleanFunction<T>
object
- the argumentdefault ExpressionType expressionType()
Expression
expressionType
in interface Expression<T>
default ToDouble<T> asDouble()
HasAsDouble
double
.asDouble
in interface HasAsDouble<T>
default ToInt<T> asInt()
HasAsInt
int
.default ToLong<T> asLong()
HasAsLong
long
.default ToDouble<T> mapToDouble(com.speedment.common.function.BooleanToDoubleFunction operator)
HasMapToDouble
double
by passing it to
the specified mapper
, producing a new expression that implements
ToDouble
.mapToDouble
in interface HasMapToDouble<T,com.speedment.common.function.BooleanToDoubleFunction>
operator
- the mapper to use on the result of this expressiondefault ToBoolean<T> map(com.speedment.common.function.BooleanUnaryOperator operator)
HasMap
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> ToBoolean<V> compose(Function<? super V,? extends T> before)
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.
ToBoolean
is a bit special when it comes to the
compose()
-method. If the before
method returns
null
, the composed expression will return false
. This is
to remain compatible with how Speedment handles predicates in streams.
To get a ToBooleanNullable
that acts as you might expect, instead
use compose(java.util.function.Function<? super V, ? extends T>)
compose
in interface HasCompose<T>
V
- the input type of the before
functionbefore
- the function to apply before this function is applieddefault <V> ToBooleanNullable<V> composeNullable(Function<? super V,? extends T> before)
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.V
- the input type of the before
functionbefore
- the function to apply before this function is appliedCopyright © 2019 Speedment, Inc.. All rights reserved.