Class ExtensionsSupport


  • public final class ExtensionsSupport
    extends java.lang.Object
    Extensions installation utility.
    Since:
    01.09.2014
    • Method Detail

      • registerExtension

        public static boolean registerExtension​(ConfigurationContext context,
                                                java.lang.Class<?> type,
                                                boolean fromScan)
        Register extension (manual or from classpath scan).
        Parameters:
        context - configuration context
        type - extension class
        fromScan - true for classpath scan
        Returns:
        true if extension recognized by installers, false otherwise
      • registerExtension

        public static boolean registerExtension​(ConfigurationContext context,
                                                java.lang.Class<?> type,
                                                FeatureInstaller installer,
                                                boolean fromScan)
        Register extension.
        Parameters:
        context - configuration context
        type - extension type
        installer - installer recognized extension (could be null)
        fromScan - from classpath scan
        Returns:
        true if extension recognized
      • registerExtensionBinding

        public static boolean registerExtensionBinding​(ConfigurationContext context,
                                                       java.lang.Class<?> type,
                                                       com.google.inject.Binding<?> manualBinding,
                                                       java.lang.Class<? extends com.google.inject.Module> topDeclarationModule)
        Register extension from guice binding. Extensions annotated with InvisibleForScanner are ignored.
        Parameters:
        context - configuration context
        type - extension type
        manualBinding - guice binding from module
        topDeclarationModule - top declaration module (which was manually added by user)
        Returns:
        true if extension recognized by installers, false otherwise
      • installExtensions

        public static void installExtensions​(ConfigurationContext context,
                                             com.google.inject.Injector injector)
        Installs extensions by instance and type. Note that jersey extensions will be processed later after jersey startup.
        Parameters:
        context - configuration context
        injector - guice injector
      • findInstaller

        public static FeatureInstaller findInstaller​(java.lang.Class<?> type,
                                                     java.util.List<FeatureInstaller> installers)
        Search for matching installer. Extension may match multiple installer, but only one will be actually used (note that installers are ordered).
        Parameters:
        type - extension type
        installers - installers
        Returns:
        matching installer or null if no matching installer found