final class ExtensionUtils
extends java.lang.Object
ExtensionRegistry
,
ExtendWith
,
RegisterExtension
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ExtensionUtils.IsNonStaticExtensionField |
(package private) static class |
ExtensionUtils.IsStaticExtensionField |
Modifier and Type | Field and Description |
---|---|
private static java.util.function.Predicate<java.lang.reflect.Field> |
isNonStaticExtension |
private static java.util.function.Predicate<java.lang.reflect.Field> |
isStaticExtension |
private static java.util.Comparator<java.lang.reflect.Field> |
orderComparator |
Modifier | Constructor and Description |
---|---|
private |
ExtensionUtils() |
Modifier and Type | Method and Description |
---|---|
private static int |
getOrder(java.lang.reflect.Field field) |
(package private) static ExtensionRegistry |
populateNewExtensionRegistryFromExtendWithAnnotation(ExtensionRegistry parentRegistry,
java.lang.reflect.AnnotatedElement annotatedElement)
Populate a new
ExtensionRegistry from extension types declared via
@ExtendWith on the supplied AnnotatedElement . |
(package private) static void |
registerExtensionsFromFields(ExtensionRegistry registry,
java.lang.Class<?> clazz,
java.lang.Object instance)
Register extensions in the supplied registry from fields in the supplied
class that are annotated with
@RegisterExtension . |
private static final java.util.function.Predicate<java.lang.reflect.Field> isStaticExtension
private static final java.util.function.Predicate<java.lang.reflect.Field> isNonStaticExtension
private static final java.util.Comparator<java.lang.reflect.Field> orderComparator
static ExtensionRegistry populateNewExtensionRegistryFromExtendWithAnnotation(ExtensionRegistry parentRegistry, java.lang.reflect.AnnotatedElement annotatedElement)
ExtensionRegistry
from extension types declared via
@ExtendWith
on the supplied AnnotatedElement
.parentRegistry
- the parent extension registry to set in the newly
created registry; never null
annotatedElement
- the annotated element on which to search for
declarations of @ExtendWith
; never null
null
static void registerExtensionsFromFields(ExtensionRegistry registry, java.lang.Class<?> clazz, java.lang.Object instance)
@RegisterExtension
.
The extensions will be sorted according to @Order
semantics
prior to registration.
registry
- the registry in which to register the extensions; never null
clazz
- the class or interface in which to find the fields; never null
instance
- the instance of the supplied class; may be null
when searching for static
fields in the classprivate static int getOrder(java.lang.reflect.Field field)