Improve registration of the same hint for multiple classes
Based on the feedback in #28977 an easy way to create a list of type references based on a vararg of classes is helpful when registering the same hints for several types.
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
|
||||
package org.springframework.aot.hint;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
@@ -81,4 +84,14 @@ public interface TypeReference {
|
||||
return SimpleTypeReference.of(className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a list of {@link TypeReference type references} mapped by the specified
|
||||
* types.
|
||||
* @param types the types to map
|
||||
* @return a list of type references
|
||||
*/
|
||||
static List<TypeReference> listOf(Class<?>... types) {
|
||||
return Arrays.stream(types).map(TypeReference::of).toList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user