Package adams.core.io
Enum MessageDigestType
- java.lang.Object
-
- java.lang.Enum<MessageDigestType>
-
- adams.core.io.MessageDigestType
-
- All Implemented Interfaces:
EnumWithCustomDisplay<MessageDigestType>
,EnumWithCustomParsing<MessageDigestType>
,Serializable
,Comparable<MessageDigestType>
public enum MessageDigestType extends Enum<MessageDigestType> implements EnumWithCustomDisplay<MessageDigestType>
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
digest(Object obj, MessageCollection errors)
Generates the digest.MessageDigestType
parse(String s)
Parses the given string and returns the associated enum.String
toDisplay()
Returns the display string.String
toRaw()
Returns the raw enum string.String
toString()
Returns the display string.static String
toString(AbstractOption option, Object object)
Returns the enum as string.static MessageDigestType
valueOf(AbstractOption option, String str)
Returns an enum generated from the string.static MessageDigestType
valueOf(String name)
Returns the enum constant of this type with the specified name.static MessageDigestType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
MD2
public static final MessageDigestType MD2
MD2.
-
MD5
public static final MessageDigestType MD5
MD5.
-
SHA1
public static final MessageDigestType SHA1
SHA-1.
-
SHA256
public static final MessageDigestType SHA256
SHA-256.
-
SHA384
public static final MessageDigestType SHA384
SHA-256.
-
SHA512
public static final MessageDigestType SHA512
SHA-256.
-
-
Method Detail
-
values
public static MessageDigestType[] 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 (MessageDigestType c : MessageDigestType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MessageDigestType 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 nameNullPointerException
- if the argument is null
-
toDisplay
public String toDisplay()
Returns the display string.- Specified by:
toDisplay
in interfaceEnumWithCustomDisplay<MessageDigestType>
- Returns:
- the display string
-
toRaw
public String toRaw()
Returns the raw enum string.- Specified by:
toRaw
in interfaceEnumWithCustomDisplay<MessageDigestType>
- Returns:
- the raw enum string
-
toString
public String toString()
Returns the display string.- Overrides:
toString
in classEnum<MessageDigestType>
- Returns:
- the display string
-
parse
public MessageDigestType parse(String s)
Parses the given string and returns the associated enum.- Specified by:
parse
in interfaceEnumWithCustomParsing<MessageDigestType>
- Parameters:
s
- the string to parse- Returns:
- the enum or null if not found
-
toString
public static String toString(AbstractOption option, Object object)
Returns the enum as string.- Parameters:
option
- the current optionobject
- the enum object to convert- Returns:
- the generated string
-
valueOf
public static MessageDigestType valueOf(AbstractOption option, String str)
Returns an enum generated from the string.- Parameters:
option
- the current optionstr
- the string to convert to an enum- Returns:
- the generated enum or null in case of error
-
digest
public String digest(Object obj, MessageCollection errors)
Generates the digest.- Parameters:
obj
- the string, string array, file or file arrayerrors
- for collecting any errors- Returns:
- the digest if successful, otherwise null
-
-