Enum Class LibraryLoader.Mode

java.lang.Object
java.lang.Enum<LibraryLoader.Mode>
com.codevasp.lazysodium.utils.LibraryLoader.Mode
All Implemented Interfaces:
Serializable, Comparable<LibraryLoader.Mode>, Constable
Enclosing class:
LibraryLoader

public static enum LibraryLoader.Mode extends 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 Details

    • 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 Details

    • values

      public static LibraryLoader.Mode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static LibraryLoader.Mode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null