ComposedUtil { public static <T, A, E extends Enum<E>> ToEnumNullable<T, E> composeToEnum(Function<T, A> before, ToEnum<A, E> after) { return new ComposeToEnum<>(before, after, after.enumClass()); } private  ComposedUtil(); static ToByteNullable<T> composeToByte(Function<T, A> before, ToByte<A> after); static ToByteNullable<T> composeToByteNullable(Function<T, A> before, ToByteNullable<A> after); static ToShortNullable<T> composeToShort(Function<T, A> before, ToShort<A> after); static ToShortNullable<T> composeToShortNullable(Function<T, A> before, ToShortNullable<A> after); static ToIntNullable<T> composeToInt(Function<T, A> before, ToInt<A> after); static ToIntNullable<T> composeToIntNullable(Function<T, A> before, ToIntNullable<A> after); static ToLongNullable<T> composeToLong(Function<T, A> before, ToLong<A> after); static ToLongNullable<T> composeToLongNullable(Function<T, A> before, ToLongNullable<A> after); static ToFloatNullable<T> composeToFloat(Function<T, A> before, ToFloat<A> after); static ToFloatNullable<T> composeToFloatNullable(Function<T, A> before, ToFloatNullable<A> after); static ToDoubleNullable<T> composeToDouble(Function<T, A> before, ToDouble<A> after); static ToDoubleNullable<T> composeToDoubleNullable(Function<T, A> before, ToDoubleNullable<A> after); static ToBoolean<T> composeToBoolean(Function<T, A> before, ToBoolean<A> after); static ToBooleanNullable<T> composeToBooleanAsNullable(Function<T, A> before, ToBoolean<A> after); static ToBooleanNullable<T> composeToBooleanNullable(Function<T, A> before, ToBooleanNullable<A> after); static ToCharNullable<T> composeToChar(Function<T, A> before, ToChar<A> after); static ToCharNullable<T> composeToCharNullable(Function<T, A> before, ToCharNullable<A> after); static ToStringNullable<T> composeToString(Function<T, A> before, ToString<A> after); static ToStringNullable<T> composeToStringNullable(Function<T, A> before, ToStringNullable<A> after); static ToBigDecimalNullable<T> composeToBigDecimal(Function<T, A> before, ToBigDecimal<A> after); static ToBigDecimalNullable<T> composeToBigDecimalNullable(Function<T, A> before, ToBigDecimalNullable<A> after); static ToEnumNullable<T, E> composeToEnum(Function<T, A> before, ToEnum<A, E> after); static ToEnumNullable<T, E> composeToEnumNullable(Function<T, A> before, ToEnumNullable<A, E> after);  }
@Test void composeToEnum() { final ToEnum<String, TestEnum> toEnum = ToEnum.of(TestEnum.class, TestEnum::valueOf); final ComposeToEnum<String, String, TestEnum, ToEnum<String, TestEnum>> composeToEnum = (ComposeToEnum<String, String, TestEnum, ToEnum<String, TestEnum>>) ComposedUtil.composeToEnum(Function.identity(), toEnum); assertEquals(TestEnum.class, composeToEnum.enumClass()); assertNotNull(composeToEnum.firstStep()); assertNotNull(composeToEnum.secondStep()); assertNull(composeToEnum.apply(null)); assertNotNull(composeToEnum.apply("VALUE")); }