Package org.artifactory.checksum
Enum ChecksumType
- java.lang.Object
-
- java.lang.Enum<ChecksumType>
-
- org.artifactory.checksum.ChecksumType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<ChecksumType>
public enum ChecksumType extends java.lang.Enum<ChecksumType>
- Author:
- Yoav Landman
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.List<ChecksumType>
BASE_CHECKSUM_TYPES
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
alg()
java.lang.String
ext()
static ChecksumType
forAlgorithm(java.lang.String algorithm)
static ChecksumType
forFilePath(java.lang.String filePath)
boolean
isValid(java.lang.String candidate)
int
length()
java.lang.String
toString()
static ChecksumType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static ChecksumType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
sha1
public static final ChecksumType sha1
-
md5
public static final ChecksumType md5
-
sha256
public static final ChecksumType sha256
-
-
Field Detail
-
BASE_CHECKSUM_TYPES
public static final java.util.List<ChecksumType> BASE_CHECKSUM_TYPES
-
-
Method Detail
-
values
public static ChecksumType[] 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 (ChecksumType c : ChecksumType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ChecksumType 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 namejava.lang.NullPointerException
- if the argument is null
-
alg
public java.lang.String alg()
-
ext
public java.lang.String ext()
- Returns:
- The filename extension of the checksum, including the dot prefix.
-
length
public int length()
- Returns:
- The length of a valid checksum for this checksum type.
-
isValid
public boolean isValid(java.lang.String candidate)
- Parameters:
candidate
- Checksum candidate- Returns:
- True if this string is a checksum value for this type
-
forFilePath
public static ChecksumType forFilePath(java.lang.String filePath)
- Parameters:
filePath
- The checksum file path (assumed to end with the checksum extension).- Returns:
- Checksum type for the given file path. Null if not found.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Enum<ChecksumType>
-
forAlgorithm
public static ChecksumType forAlgorithm(java.lang.String algorithm)
-
-