@Test void genericTypeArgumentInvalidIndex() { calling(() -> FieldUtil.genericTypeArgument(ClassUtil.getDeclaredField(ClassWithStringField.class, "optionalStringField"), 1)) .shouldThrow(ArrayIndexOutOfBoundsException.class); }
public static Optional<Class<?>> genericTypeArgument(Field field, int index) { return genericType(field) .map(gt -> TypeUtil.actualTypeArgument(gt, index)); }
FieldUtil extends UtilityClass { public static Optional<Class<?>> genericTypeArgument(Field field, int index) { return genericType(field) .map(gt -> TypeUtil.actualTypeArgument(gt, index)); } }
FieldUtil extends UtilityClass { public static Optional<Class<?>> genericTypeArgument(Field field, int index) { return genericType(field) .map(gt -> TypeUtil.actualTypeArgument(gt, index)); }  }
FieldUtil extends UtilityClass { public static Optional<Class<?>> genericTypeArgument(Field field, int index) { return genericType(field) .map(gt -> TypeUtil.actualTypeArgument(gt, index)); }  static void set(Field field, Object target, Object value); static Object get(Field field, Object target); static Object get(String fieldName, Object target); static Optional<Class<?>> genericTypeArgument(Field field, int index); static boolean hasAnnotation(Class<? extends Annotation> annotationClass, Field field); static Optional<A> annotation(Class<A> annotationClass, Field field); }
FieldUtil extends UtilityClass { public static Optional<Class<?>> genericTypeArgument(Field field, int index) { return genericType(field) .map(gt -> TypeUtil.actualTypeArgument(gt, index)); }  static void set(Field field, Object target, Object value); static Object get(Field field, Object target); static Object get(String fieldName, Object target); static Optional<Class<?>> genericTypeArgument(Field field, int index); static boolean hasAnnotation(Class<? extends Annotation> annotationClass, Field field); static Optional<A> annotation(Class<A> annotationClass, Field field);  }