Interface ToBoolean<T>

    • Method Detail

      • of

        static <T> ToBoolean<T> of​(Predicate<T> lambda)
        Returns a typed ToBoolean<T> using the provided lambda.
        Type Parameters:
        T - type to extract from
        Parameters:
        lambda - to convert
        Returns:
        a typed ToBoolean<T> using the provided lambda
        Throws:
        NullPointerException - if the provided lambda is null
      • expressionType

        default ExpressionType expressionType()
        Description copied from interface: Expression
        Returns the expression type of this expression. It should be safe to cast this instance into the corresponding interface.
        Specified by:
        expressionType in interface Expression<T>
        Returns:
        the expression type
      • asDouble

        default ToDouble<T> asDouble()
        Description copied from interface: HasAsDouble
        Returns an expression that casts the result of the current expression into a double.
        Specified by:
        asDouble in interface HasAsDouble<T>
        Returns:
        the casted expression
      • asInt

        default ToInt<T> asInt()
        Description copied from interface: HasAsInt
        Returns an expression that casts the result of the current expression into an int.
        Specified by:
        asInt in interface HasAsInt<T>
        Returns:
        the casted expression
      • asLong

        default ToLong<T> asLong()
        Description copied from interface: HasAsLong
        Returns an expression that casts the result of the current expression into a long.
        Specified by:
        asLong in interface HasAsLong<T>
        Returns:
        the casted expression
      • map

        default ToBoolean<T> map​(BooleanUnaryOperator operator)
        Description copied from interface: HasMap
        Returns an expression for the value of this expression mapped using the specified mapping function. The input type remains the same.
        Specified by:
        map in interface HasMap<T,​BooleanUnaryOperator,​ToBoolean<T>>
        Parameters:
        operator - the mapping function
        Returns:
        the mapped expression
      • hash

        default long hash​(T object)
        Description copied from interface: HasHash
        Hash the specified object into a 64-bit hash. If two equal objects are hashed, they must always result in the same hash. However, objects that are not equal may also result in the same hash.
        Specified by:
        hash in interface HasHash<T>
        Parameters:
        object - the object to hash
        Returns:
        the 64-bit hashcode
      • compose

        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. 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>)

        Specified by:
        compose in interface HasCompose<T>
        Type Parameters:
        V - the input type of the before function
        Parameters:
        before - the function to apply before this function is applied
        Returns:
        the composed expression
      • composeNullable

        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. If evaluation of either function throws an exception, it is relayed to the caller of the composed function.
        Type Parameters:
        V - the input type of the before function
        Parameters:
        before - the function to apply before this function is applied
        Returns:
        the composed expression
        Since:
        3.1.2