Enum BuiltinMacs

    • Method Detail

      • values

        public static BuiltinMacs[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (BuiltinMacs c : BuiltinMacs.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static BuiltinMacs valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • create

        public Mac create()
        Specified by:
        create in interface Factory<Mac>
        Returns:
        A new instance
      • getBlockSize

        public final int getBlockSize()
        Specified by:
        getBlockSize in interface MacInformation
        Returns:
        MAC output block size in bytes - may be less than the default - e.g., MD5-96
      • getDefaultBlockSize

        public final int getDefaultBlockSize()
        Specified by:
        getDefaultBlockSize in interface MacInformation
        Returns:
        The "natural" MAC block size in bytes
      • registerExtension

        public static void registerExtension​(MacFactory extension)
        Registered a NamedFactory to be available besides the built-in ones when parsing configuration
        Parameters:
        extension - The factory to register
        Throws:
        IllegalArgumentException - if factory instance is null, or overrides a built-in one or overrides another registered factory with the same name (case insensitive).
      • getRegisteredExtensions

        public static NavigableSet<MacFactory> getRegisteredExtensions()
        Returns:
        A NavigableSet of the currently registered extensions, sorted according to the factory name (case insensitive)
      • unregisterExtension

        public static MacFactory unregisterExtension​(String name)
        Unregisters specified extension
        Parameters:
        name - The factory name - ignored if null/empty
        Returns:
        The registered extension - null if not found
      • fromString

        public static BuiltinMacs fromString​(String s)
        Parameters:
        s - The Enum's name - ignored if null/empty
        Returns:
        The matching BuiltinMacs whose Enum.name() matches (case insensitive) the provided argument - null if no match
      • fromFactoryName

        public static BuiltinMacs fromFactoryName​(String name)
        Parameters:
        name - The factory name - ignored if null/empty
        Returns:
        The matching BuiltinMacs whose factory name matches (case insensitive) the provided name - null if no match
      • parseMacsList

        public static BuiltinMacs.ParseResult parseMacsList​(String macs)
        Parameters:
        macs - A comma-separated list of MACs' names - ignored if null/empty
        Returns:
        A BuiltinMacs.ParseResult containing the successfully parsed factories and the unknown ones. Note: it is up to caller to ensure that the lists do not contain duplicates
      • resolveFactory

        public static MacFactory resolveFactory​(String name)
        Parameters:
        name - The factory name
        Returns:
        The factory or null if it is neither a built-in one or a registered extension