Interface ToObjectFunction<T,R>
- Type Parameters:
T
- the input typeR
- the return type
- All Superinterfaces:
Function<T,
,R> TypedFunction<T>
Note: this is not a FunctionalInterface
, as returnType()
must be provided.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.deephaven.function.TypedFunction
TypedFunction.Visitor<T,
R> -
Method Summary
Modifier and TypeMethodDescriptiondefault <T2 extends T,
R2>
ToObjectFunction<T2,R2> cast
(GenericType<R2> returnType) Creates a function by casting toreturnType
.static <T> ToObjectFunction<T,
Object> identity()
Creates an object function that casts each input toObject
.static <T,
R extends T>
ToObjectFunction<T,R> identity
(GenericType<R> returnType) Creates an object function that casts each input toreturnType
.default <T2 extends T>
TypedFunction<T2>map
(TypedFunction<? super R> g) Creates the function compositiong ∘ this
.static <T,
R, Z> ToObjectFunction<T, Z> map
(Function<? super T, ? extends R> f, ToObjectFunction<? super R, Z> g) Creates the function compositiong ∘ f
.static <T,
R, Z> ToObjectFunction<T, Z> map
(Function<? super T, ? extends R> f, Function<? super R, ? extends Z> g, GenericType<Z> returnType) Creates the function compositiong ∘ f
.default <T2 extends T>
ToBooleanFunction<T2>mapToBoolean
(Predicate<? super R> g) Creates the function compositiong ∘ this
.default <T2 extends T>
ToByteFunction<T2>mapToByte
(ToByteFunction<? super R> g) Creates the function compositiong ∘ this
.default <T2 extends T>
ToCharFunction<T2>mapToChar
(ToCharFunction<? super R> g) Creates the function compositiong ∘ this
.default <T2 extends T>
ToDoubleFunction<T2>mapToDouble
(ToDoubleFunction<? super R> g) Creates the function compositiong ∘ this
.default <T2 extends T>
ToFloatFunction<T2>mapToFloat
(ToFloatFunction<? super R> g) Creates the function compositiong ∘ this
.default <T2 extends T>
ToIntFunction<T2>mapToInt
(ToIntFunction<? super R> g) Creates the function compositiong ∘ this
.default <T2 extends T>
ToLongFunction<T2>mapToLong
(ToLongFunction<? super R> g) Creates the function compositiong ∘ this
.default <T2 extends T,
R2>
ToObjectFunction<T2,R2> mapToObj
(ToObjectFunction<? super R, R2> g) Creates the function compositiong ∘ this
.default <T2 extends T,
R2>
ToObjectFunction<T2,R2> mapToObj
(Function<? super R, ? extends R2> g, GenericType<R2> returnType) Creates the function compositiong ∘ this
.default <T2 extends T>
ToPrimitiveFunction<T2>mapToPrimitive
(ToPrimitiveFunction<? super R> g) Creates the function compositiong ∘ this
.default <T2 extends T>
ToShortFunction<T2>mapToShort
(ToShortFunction<? super R> g) Creates the function compositiong ∘ this
.static <T,
R> ToObjectFunction<T, R> of
(Function<? super T, ? extends R> f, GenericType<R> returnType) Creates an object function fromf
andreturnType
.This function's return type.default <Z> Z
walk
(TypedFunction.Visitor<T, Z> visitor)
-
Method Details
-
of
static <T,R> ToObjectFunction<T,R> of(Function<? super T, ? extends R> f, GenericType<R> returnType) Creates an object function fromf
andreturnType
.- Type Parameters:
T
- the input typeR
- the return type- Parameters:
f
- the functionreturnType
- the return type- Returns:
- the object function
-
identity
Creates an object function that casts each input toObject
. Equivalent tox -> (Object)x
.- Type Parameters:
T
- the input type- Returns:
- the object function
-
identity
Creates an object function that casts each input toreturnType
. Equivalent tox -> (R)x
.- Type Parameters:
T
- the input typeR
- the return type- Parameters:
returnType
- the return type- Returns:
- the object function
-
map
static <T,R, ToObjectFunction<T,Z> Z> map(Function<? super T, ? extends R> f, ToObjectFunction<? super R, Z> g) Creates the function compositiong ∘ f
.Equivalent to
x -> g.apply(f.apply(x))
.- Type Parameters:
T
- the input typeR
- the intermediate typeZ
- the return type- Parameters:
f
- the inner functiong
- the outer function- Returns:
- the object function
-
map
static <T,R, ToObjectFunction<T,Z> Z> map(Function<? super T, ? extends R> f, Function<? super R, ? extends Z> g, GenericType<Z> returnType) Creates the function compositiong ∘ f
.Equivalent to
x -> g.apply(f.apply(x))
.- Type Parameters:
T
- the input typeR
- the intermediate typeZ
- the return type- Parameters:
f
- the inner functiong
- the outer functionreturnType
- the return type- Returns:
- the object function
-
returnType
GenericType<R> returnType()Description copied from interface:TypedFunction
This function's return type.- Specified by:
returnType
in interfaceTypedFunction<T>
- Returns:
- the type
-
apply
-
mapToBoolean
Creates the function compositiong ∘ this
.Equivalent to
x -> g.test(this.apply(x))
.- Type Parameters:
T2
- the returned function input type- Parameters:
g
- the outer function- Returns:
- the boolean function
-
mapToChar
Creates the function compositiong ∘ this
.Equivalent to
x -> g.applyAsChar(this.apply(x))
.- Type Parameters:
T2
- the returned function input type- Parameters:
g
- the outer function- Returns:
- the char function
-
mapToByte
Creates the function compositiong ∘ this
.Equivalent to
x -> g.applyAsByte(this.apply(x))
.- Type Parameters:
T2
- the returned function input type- Parameters:
g
- the outer function- Returns:
- the byte function
-
mapToShort
Creates the function compositiong ∘ this
.Equivalent to
x -> g.applyAsShort(this.apply(x))
.- Type Parameters:
T2
- the returned function input type- Parameters:
g
- the outer function- Returns:
- the short function
-
mapToInt
Creates the function compositiong ∘ this
.Equivalent to
x -> g.applyAsInt(this.apply(x))
.- Type Parameters:
T2
- the returned function input type- Parameters:
g
- the outer function- Returns:
- the int function
-
mapToLong
Creates the function compositiong ∘ this
.Equivalent to
x -> g.applyAsLong(this.apply(x))
.- Type Parameters:
T2
- the returned function input type- Parameters:
g
- the outer function- Returns:
- the long function
-
mapToFloat
Creates the function compositiong ∘ this
.Equivalent to
x -> g.applyAsFloat(this.apply(x))
.- Type Parameters:
T2
- the returned function input type- Parameters:
g
- the outer function- Returns:
- the float function
-
mapToDouble
Creates the function compositiong ∘ this
.Equivalent to
x -> g.applyAsDouble(this.apply(x))
.- Type Parameters:
T2
- the returned function input type- Parameters:
g
- the outer function- Returns:
- the double function
-
mapToObj
Creates the function compositiong ∘ this
.Equivalent to
x -> g.apply(this.apply(x))
.- Type Parameters:
T2
- the returned function input typeR2
- the returned function return type- Parameters:
g
- the outer function- Returns:
- the object function
-
mapToObj
default <T2 extends T,R2> ToObjectFunction<T2,R2> mapToObj(Function<? super R, ? extends R2> g, GenericType<R2> returnType) Creates the function compositiong ∘ this
.Equivalent to
x -> g.apply(this.apply(x))
.- Type Parameters:
T2
- the returned function input typeR2
- the returned function return type- Parameters:
g
- the outer function- Returns:
- the object function
-
mapToPrimitive
Creates the function compositiong ∘ this
.Prefer to call one of the more strongly-typed map methods if you have a more specific function type.
- Type Parameters:
T2
- the returned function input type- Parameters:
g
- the outer function- Returns:
- the function
- See Also:
-
map
Creates the function compositiong ∘ this
.Prefer to call one of the more strongly-typed map methods if you have a more specific function type.
- Type Parameters:
T2
- the returned function input type- Parameters:
g
- the outer function- Returns:
- the function
- See Also:
-
cast
Creates a function by casting toreturnType
.In the case where
returnType().equals(returnType)
, the result is(ObjectFunction<T2, R2>) this
. Otherwise, the result is equivalent tox -> (R2) this.apply(x)
.- Type Parameters:
T2
- the returned function input typeR2
- the returned function return type- Parameters:
returnType
- the return type- Returns:
- the object function
-
walk
- Specified by:
walk
in interfaceTypedFunction<T>
-