Enum LibraryLoader.Mode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<LibraryLoader.Mode>
    Enclosing class:
    LibraryLoader

    public static enum LibraryLoader.Mode
    extends java.lang.Enum<LibraryLoader.Mode>
    Library loading mode controls which libraries are attempted to be loaded (installed in the system or bundled in the Lazysodium JAR) and in which order.
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      BUNDLED_ONLY
      Load the bundled version, ignoring the system.
      PREFER_BUNDLED
      Load the bundled native libraries first, then fallback to finding it in the system.
      PREFER_SYSTEM
      Try to load the system sodium first, if that fails — load the bundled version.
      SYSTEM_ONLY
      Load the system sodium only, ignoring the bundled.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static LibraryLoader.Mode valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static LibraryLoader.Mode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • PREFER_SYSTEM

        public static final LibraryLoader.Mode PREFER_SYSTEM
        Try to load the system sodium first, if that fails — load the bundled version.

        This is the recommended mode, because it allows the clients to upgrade the sodium library as soon as it is available instead of waiting for lazysodium release and releasing a new version of the client library/application.

      • PREFER_BUNDLED

        public static final LibraryLoader.Mode PREFER_BUNDLED
        Load the bundled native libraries first, then fallback to finding it in the system.
      • BUNDLED_ONLY

        public static final LibraryLoader.Mode BUNDLED_ONLY
        Load the bundled version, ignoring the system.

        This mode might be useful if the system sodium turns out to be outdated and cannot be upgraded.

      • SYSTEM_ONLY

        public static final LibraryLoader.Mode SYSTEM_ONLY
        Load the system sodium only, ignoring the bundled.

        This mode is recommended if it is required to use the system sodium only, and the application must fail if it is not installed.

    • Method Detail

      • values

        public static LibraryLoader.Mode[] 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 (LibraryLoader.Mode c : LibraryLoader.Mode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static LibraryLoader.Mode valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null