Class BundleSupport

java.lang.Object
org.tentackle.common.BundleSupport

public class BundleSupport extends Object
Support to locate bundle services.

Annotations marking classes as bundles, such as @Bundle or @FxControllerService, must be listed in META-INF/services/org.tentackle.common.BundleSupport of the module declaring the annotation. This entry must be created manually in order to be processed by the BundleFactory at runtime as well as by the tentackle-, check- and i18n-maven-plugins at build time.

For each such annotation, the analyze goal of the tentackle-maven-plugin writes the annotated classes to META-INF/bundles/<annotation classname>, one entry per line, in the form

  bundleName
or, if the bundle is registered under an additional key name (see Bundle.value()),
  keyName = bundleName
Colons and spaces are accepted as separators as well.
Author:
harald
See Also:
  • Field Details

    • BUNDLE_SERVICE

      public static final String BUNDLE_SERVICE
      The service name to find all annotations to mark classes as bundles.
      Such as @Bundle or @FxControllerService.
  • Constructor Details

    • BundleSupport

      public BundleSupport(ModuleInfo info, String className, String bundleName)
      Creates a bundle support object.
      Parameters:
      info - the optional jigsaw module info, null if none
      className - the key name the bundle is registered for, usually the same as the bundle name
      bundleName - the name of the resource bundle, i.e., the name of the annotated class
  • Method Details

    • getBundles

      public static List<BundleSupport> getBundles(ClassLoader classLoader)
      Finds all bundle services.
      Parameters:
      classLoader - the classloader, null if default
      Returns:
      the list of bundle supports
      Throws:
      TentackleRuntimeException - if an entry is malformed
    • getModuleInfo

      public ModuleInfo getModuleInfo()
      Gets the module info.
      Returns:
      the optional module info, null if none
    • getClassName

      public String getClassName()
      Gets the key name the bundle is registered for.
      This is the same as the bundle name, unless the bundle was registered under an additional key name (see Bundle.value()).
      Returns:
      the key name
    • getBundleName

      public String getBundleName()
      Gets the bundle name.
      This is the name of the annotated class.
      Returns:
      the bundle name