- All Implemented Interfaces:
Serializable,Comparable<GlobalMailAccount>,Constable
Represents a global mail account, implemented as a singleton enum. This class is responsible for loading and holding
a single, globally accessible
MailAccount instance from a configuration file specified in
MailAccount.MAIL_SETTING_PATHS.- Since:
- Java 17+
- Author:
- Kimi Liu
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the globally configured mail account.voidsetCharset(Charset charset) Sets the global default character set for MIME messages.voidsetSplitLongParams(boolean splitLongParams) Sets whether to split long parameters in MIME headers.static GlobalMailAccountReturns the enum constant of this class with the specified name.static GlobalMailAccount[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
INSTANCE
The singleton instance of the global mail account.
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
getAccount
Retrieves the globally configured mail account.- Returns:
- The global
MailAccountinstance.
-
setSplitLongParams
public void setSplitLongParams(boolean splitLongParams) Sets whether to split long parameters in MIME headers. This is a global setting. Note: This method callsSystem.setProperty(String, String).- Parameters:
splitLongParams-trueto enable splitting,falseto disable it.
-
setCharset
Sets the global default character set for MIME messages. Note: This method callsSystem.setProperty(String, String).- Parameters:
charset- The character set to set as the global default.
-