Add shortcut method to register multiple types hints

Closes gh-28339
This commit is contained in:
Stephane Nicoll
2022-04-14 10:22:07 +02:00
parent 780d07217b
commit 5be6b3d2a7
2 changed files with 28 additions and 0 deletions

View File

@@ -95,6 +95,19 @@ public class ReflectionHints {
return registerType(TypeReference.of(type), typeHint);
}
/**
* Register or customize reflection hints for the types defined by the
* specified list of {@link TypeReference type references}. The specified
* {@code typeHint} consumer is invoked for each type.
* @param types the types to customize
* @param typeHint a builder to further customize hints for each type
* @return {@code this}, to facilitate method chaining
*/
public ReflectionHints registerTypes(Iterable<TypeReference> types, Consumer<TypeHint.Builder> typeHint) {
types.forEach(type -> registerType(type, typeHint));
return this;
}
/**
* Register the need for reflection on the specified {@link Field}.
* @param field the field that requires reflection