Interface ToEnum<T,​E extends Enum<E>>

    • Method Detail

      • of

        static <T,​E extends Enum<E>> ToEnum<T,​E> of​(Class<E> enumClass,
                                                                Function<T,​E> lambda)
        Returns a typed ToEnum<T> using the provided lambda.
        Type Parameters:
        T - type to extract from
        E - enum type
        Parameters:
        lambda - to convert
        enumClass - class of the enum
        Returns:
        a typed ToEnum<T> using the provided lambda
        Throws:
        NullPointerException - if the provided lambda is null
      • enumClass

        Class<E> enumClass()
        Returns the class of the enum that this expression returns.
        Returns:
        the enum class
      • 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
      • asOrdinal

        default ToInt<T> asOrdinal()
        Returns an alternative expression that represents the Enum.ordinal() of the enum that would otherwise have been returned by this expression.
        Returns:
        the ordinal expression
      • asName

        default ToString<T> asName()
        Returns an alternative expression that represents the Enum.name() of the enum that would otherwise have been returned by this expression.
        Returns:
        the name expression
      • map

        default ToEnum<T,​E> map​(UnaryOperator<E> mapper)
        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,​UnaryOperator<E extends Enum<E>>,​ToEnum<T,​E extends Enum<E>>>
        Parameters:
        mapper - 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> ToEnumNullable<V,​E> compose​(Function<? super V,​? extends T> before)
        Description copied from interface: HasCompose
        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.
        Specified by:
        compose in interface Function<T,​E extends Enum<E>>
        Specified by:
        compose in interface HasCompose<T>
        Type Parameters:
        V - the type of input to the before function, and to the composed expression
        Parameters:
        before - the function to apply before this function is applied
        Returns:
        a composed function that first applies the before function and then applies this function