Enum Class Configuration

java.lang.Object
java.lang.Enum<Configuration>
com.nilhcem.fakesmtp.core.Configuration
All Implemented Interfaces:
Serializable, Comparable<Configuration>, java.lang.constant.Constable

public enum Configuration extends Enum<Configuration>
Contains and returns some project-specific configuration variables.
Since:
1.0
Author:
Nilhcem
  • Enum Constant Details

  • Method Details

    • values

      public static Configuration[] 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 Configuration 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
    • get

      public String get(String key)
      Returns the value of a specific entry from the "configuration.properties" file.
      Parameters:
      key - a string representing the key from a key/value couple.
      Returns:
      the value of the key, or an empty string if the key was not found.
    • set

      public void set(String key, String value)
      Sets the value of a specific entry.
      Parameters:
      key - a string representing the key from a key/value couple.
      value - the value of the key.
    • saveToFile

      public void saveToFile(File file) throws IOException
      Saves configuration to file.
      Parameters:
      file - file to save configuration.
      Throws:
      IOException
    • saveToUserProfile

      public void saveToUserProfile() throws IOException
      Saves configuration to the .fakesmtp.properties file in user profile directory. Calls saveToFile(java.io.File).
      Throws:
      IOException
    • loadFromFile

      public Configuration loadFromFile(File file) throws IOException
      Loads configuration from file.
      Parameters:
      file - file to load configuration.
      Returns:
      INSTANCE.
      Throws:
      IOException
    • loadFromUserProfile

      public Configuration loadFromUserProfile() throws IOException
      Loads configuration from the .fakesmtp.properties file in user profile directory. Calls loadFromFile(java.io.File).
      Returns:
      INSTANCE.
      Throws:
      IOException