Package com.speedment.runtime.compute
Interface ToIntNullable<T>
-
- Type Parameters:
T- type to extract from
- All Superinterfaces:
Comparator<T>,Expression<T>,Function<T,Integer>,HasAbs<ToIntNullable<T>>,HasCompare<T>,HasCompose<T>,HasHash<T>,HasMapIfPresent<T,IntUnaryOperator,ToIntNullable<T>>,HasMapToDoubleIfPresent<T,IntToDoubleFunction>,HasNegate<ToIntNullable<T>>,HasSign<ToByteNullable<T>>,HasSqrt<ToDoubleNullable<T>>,ToIntFunction<T>,ToNullable<T,Integer,ToInt<T>>
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface ToIntNullable<T> extends Expression<T>, ToIntFunction<T>, ToNullable<T,Integer,ToInt<T>>, HasAbs<ToIntNullable<T>>, HasSign<ToByteNullable<T>>, HasSqrt<ToDoubleNullable<T>>, HasNegate<ToIntNullable<T>>, HasMapToDoubleIfPresent<T,IntToDoubleFunction>, HasMapIfPresent<T,IntUnaryOperator,ToIntNullable<T>>, HasHash<T>, HasCompare<T>, HasCompose<T>
Expression that given an entity returns anintvalue, ornull. This expression can be implemented using a lamdda, or it can be a result of another operation. It has additional methods for operating on it.- Since:
- 3.1.0
- Author:
- Emil Forslund
- See Also:
Function
-
-
Method Summary
All Methods Static Methods Instance Methods Default Methods Modifier and Type Method Description default ToIntNullable<T>abs()Returns a new expression that returns the absolute value of the result of the current expression.default intapplyAsInt(T object)default intcompare(T first, T second)default <V> ToIntNullable<V>compose(Function<? super V,? extends T> before)Returns a composed expression that first applies thebeforefunction to its input, and then applies this function to the result.default ExpressionTypeexpressionType()Returns the expression type of this expression.default longhash(T object)Hash the specified object into a 64-bit hash.default ToIntNullable<T>mapIfPresent(IntUnaryOperator mapper)Returns an expression for the value of this expression mapped using the specified mapping function.default ToDoubleNullable<T>mapToDoubleIfPresent(IntToDoubleFunction mapper)Maps the result of this expression into adoubleby passing it to the specifiedmapper, producing a new expression that implementsToDouble.default ToIntNullable<T>negate()Returns a new expression that returns the absolute value of the result of the current expression.static <T> ToIntNullable<T>of(Function<T,Integer> lambda)Returns a typedToIntNullable<T>using the providedlambda.default ToInt<T>orElse(Integer value)Returns an equivalent expression as this, except that it will return thevalueif given an argument that would cause this expression to returnnull.default ToInt<T>orElseGet(ToInt<T> getter)Returns an equivalent expression as this, except that it will return thegetterexpression if given an argument that would cause this expression to returnnull.default ToInt<T>orThrow()Returns an equivalent expression as this, except that it will throw aNullPointerExceptionif given an argument that would cause this expression to returnnull.default ToByteNullable<T>sign()Creates and returns an expression that returns1if the result of the this expression is positive,-1if the result of this expression is negative and0if the result of this expression is0.default ToDoubleNullable<T>sqrt()Creates and returns an expression that returns the square root of the result from the current expression.-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface com.speedment.runtime.compute.trait.ToNullable
isNotNull, isNotNull, isNull, isNull
-
-
-
-
Method Detail
-
of
static <T> ToIntNullable<T> of(Function<T,Integer> lambda)
Returns a typedToIntNullable<T>using the providedlambda.- Type Parameters:
T- type to extract from- Parameters:
lambda- to convert- Returns:
- a typed
ToIntNullable<T>using the providedlambda - Throws:
NullPointerException- if the providedlambdaisnull
-
expressionType
default ExpressionType expressionType()
Description copied from interface:ExpressionReturns the expression type of this expression. It should be safe to cast this instance into the corresponding interface.- Specified by:
expressionTypein interfaceExpression<T>- Returns:
- the expression type
-
applyAsInt
default int applyAsInt(T object)
- Specified by:
applyAsIntin interfaceToIntFunction<T>
-
orThrow
default ToInt<T> orThrow()
Description copied from interface:ToNullableReturns an equivalent expression as this, except that it will throw aNullPointerExceptionif given an argument that would cause this expression to returnnull.
-
orElseGet
default ToInt<T> orElseGet(ToInt<T> getter)
Description copied from interface:ToNullableReturns an equivalent expression as this, except that it will return thegetterexpression if given an argument that would cause this expression to returnnull.
-
orElse
default ToInt<T> orElse(Integer value)
Description copied from interface:ToNullableReturns an equivalent expression as this, except that it will return thevalueif given an argument that would cause this expression to returnnull.
-
abs
default ToIntNullable<T> abs()
Description copied from interface:HasAbsReturns a new expression that returns the absolute value of the result of the current expression.
-
negate
default ToIntNullable<T> negate()
Description copied from interface:HasNegateReturns a new expression that returns the absolute value of the result of the current expression. For an example, a positive value will become negative and a negative value will become positive.
-
sign
default ToByteNullable<T> sign()
Description copied from interface:HasSignCreates and returns an expression that returns1if the result of the this expression is positive,-1if the result of this expression is negative and0if the result of this expression is0.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
sqrt
default ToDoubleNullable<T> sqrt()
Description copied from interface:HasSqrtCreates and returns an expression that returns the square root of the result from the current expression.If this expression is nullable and the result was
null, then the result of the returned expression will also benull.
-
mapToDoubleIfPresent
default ToDoubleNullable<T> mapToDoubleIfPresent(IntToDoubleFunction mapper)
Description copied from interface:HasMapToDoubleIfPresentMaps the result of this expression into adoubleby passing it to the specifiedmapper, producing a new expression that implementsToDouble. If this expression would have evaluated tonull, then the new expression will as well.- Specified by:
mapToDoubleIfPresentin interfaceHasMapToDoubleIfPresent<T,IntToDoubleFunction>- Parameters:
mapper- the mapper to use on the result of this expression- Returns:
- the new mapped expression
-
mapIfPresent
default ToIntNullable<T> mapIfPresent(IntUnaryOperator mapper)
Description copied from interface:HasMapIfPresentReturns an expression for the value of this expression mapped using the specified mapping function. The input type remains the same.- Specified by:
mapIfPresentin interfaceHasMapIfPresent<T,IntUnaryOperator,ToIntNullable<T>>- Parameters:
mapper- the mapping function- Returns:
- the mapped expression
-
hash
default long hash(T object)
Description copied from interface:HasHashHash 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.
-
compare
default int compare(T first, T second)
- Specified by:
comparein interfaceComparator<T>- Specified by:
comparein interfaceHasCompare<T>
-
compose
default <V> ToIntNullable<V> compose(Function<? super V,? extends T> before)
Description copied from interface:HasComposeReturns a composed expression that first applies thebeforefunction 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:
composein interfaceFunction<T,Integer>- Specified by:
composein interfaceHasCompose<T>- Type Parameters:
V- the type of input to thebeforefunction, and to the composed expression- Parameters:
before- the function to apply before this function is applied- Returns:
- a composed function that first applies the
beforefunction and then applies this function
-
-