Class ModuleIdentifierUtil


  • public final class ModuleIdentifierUtil
    extends Object
    Provides utilities related to working with names of JBoss Modules modules.
    • Constructor Detail

      • ModuleIdentifierUtil

        public ModuleIdentifierUtil()
    • Method Detail

      • canonicalModuleIdentifier

        public static String canonicalModuleIdentifier​(String moduleSpec)
        Provides the canonical string representation of a module identifier from a string of the form name[:slot]. The canonical representation will not include slot information if the slot is main.
        Parameters:
        moduleSpec - a module name specification in the form name[:slot]. Cannot be null
        Returns:
        the canonical representation. Will not return @{code null}
      • parseModuleIdentifier

        public static <R> R parseModuleIdentifier​(String moduleIdentifier,
                                                  BiFunction<String,​String,​R> function)
        Parses the given module identifier into name and optional slot elements, passing those to the given function and returning the result of that function.

        This variant does not canonicalize the given identifier.

        Type Parameters:
        R - the type returned by function
        Parameters:
        moduleIdentifier - an identifier for a module. Cannot be null
        function - a function to apply to the module's name and optional slot. Cannot be null. The slot value passed to the function may be null if the identifier does not contain one.
        Returns:
        the value returned by function
      • parseModuleIdentifier

        public static <R> R parseModuleIdentifier​(String moduleIdentifier,
                                                  BiFunction<String,​String,​R> function,
                                                  boolean canonicalize)
        Parses the given module identifier into name and optional slot elements, passing those to the given function and returning the result of that function.

        Type Parameters:
        R - the type returned by function
        Parameters:
        moduleIdentifier - an identifier for a module. Cannot be null
        function - a function to apply to the module's name and optional slot. Cannot be null. The slot value passed to the function may be null if the identifier does not contain one.
        canonicalize - if true the identifier will be canonicalized before parsing
        Returns:
        the value returned by function
      • parseModuleIdentifier

        public static <R> R parseModuleIdentifier​(String moduleIdentifier,
                                                  BiFunction<String,​String,​R> function,
                                                  boolean canonicalize,
                                                  String defaultSlot)
        Parses the given module identifier into name and optional slot elements, passing those to the given function and returning the result of that function.

        Type Parameters:
        R - the type returned by function
        Parameters:
        moduleIdentifier - an identifier for a module. Cannot be null
        function - a function to apply to the module's name and optional slot. Cannot be null. The slot value passed to the function may be null if the identifier does not contain one.
        canonicalize - if true the identifier will be canonicalized before parsing
        defaultSlot - string to pass to function as the slot parameter if the identifier doesn't include a slot value. May be null
        Returns:
        the value returned by function
      • canonicalModuleIdentifier

        public static String canonicalModuleIdentifier​(String name,
                                                       String slot)
        Provides the canonical string representation of a module identifier from a base module name and an optional slot. The canonical representation will not include slot information if the slot is main.
        Parameters:
        name - the base module name. Cannot be null
        slot - the module slot. May be @{code null}
        Returns:
        the canonical representation. Will not return @{code null}