Class ExtensionUtils

    • Field Detail

      • orderComparator

        private static final java.util.Comparator<java.lang.reflect.Field> orderComparator
        Since:
        5.4
    • Constructor Detail

      • ExtensionUtils

        private ExtensionUtils()
    • Method Detail

      • populateNewExtensionRegistryFromExtendWithAnnotation

        static MutableExtensionRegistry populateNewExtensionRegistryFromExtendWithAnnotation​(MutableExtensionRegistry parentRegistry,
                                                                                             java.lang.reflect.AnnotatedElement annotatedElement)
        Populate a new MutableExtensionRegistry from extension types declared via @ExtendWith on the supplied AnnotatedElement.
        Parameters:
        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
        Returns:
        the new extension registry; never null
        Since:
        5.0
      • registerExtensionsFromFields

        static void registerExtensionsFromFields​(ExtensionRegistrar registrar,
                                                 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.

        The extensions will be sorted according to @Order semantics prior to registration.

        Parameters:
        registrar - the registrar with 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 class
      • getOrder

        private static int getOrder​(java.lang.reflect.Field field)
        Since:
        5.4