All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.nichetoolkit.rest.worker.sha.ShaAlgorithm Maven / Gradle / Ivy

The newest version!
package io.github.nichetoolkit.rest.worker.sha;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import io.github.nichetoolkit.rest.RestAlgorithm;
import io.github.nichetoolkit.rest.RestValue;
import org.springframework.lang.NonNull;

import java.util.Optional;

/**
 * ShaAlgorithm
 * 

The sha algorithm enumeration.

* @author Cyan ([email protected]) * @see io.github.nichetoolkit.rest.RestAlgorithm * @since Jdk1.8 */ public enum ShaAlgorithm implements RestAlgorithm { /** * SHA1 *

The sha 1 sha algorithm field.

*/ SHA1(1,"SHA1","SHA"), /** * SHA224 *

The sha 224 sha algorithm field.

*/ SHA224(2,"SHA224","SHA-224"), /** * SHA256 *

The sha 256 sha algorithm field.

*/ SHA256(3,"SHA256","SHA-256"), /** * SHA384 *

The sha 384 sha algorithm field.

*/ SHA384(4,"SHA384","SHA-384"), /** * SHA512 *

The sha 512 sha algorithm field.

*/ SHA512(5,"SHA512","SHA-512"), ; /** * key * {@link java.lang.Integer}

The key field.

* @see java.lang.Integer */ private final Integer key; /** * value * {@link java.lang.String}

The value field.

* @see java.lang.String */ private final String value; /** * algorithm * {@link java.lang.String}

The algorithm field.

* @see java.lang.String */ private final String algorithm; /** * ShaAlgorithm *

Instantiates a new sha algorithm.

* @param key {@link java.lang.Integer}

The key parameter is Integer type.

* @param value {@link java.lang.String}

The value parameter is String type.

* @param algorithm {@link java.lang.String}

The algorithm parameter is String type.

* @see java.lang.Integer * @see java.lang.String */ ShaAlgorithm(Integer key,String value,String algorithm) { this.key = key; this.value = value; this.algorithm = algorithm; } @JsonValue @Override public Integer getKey() { return this.key; } @Override public String getValue() { return this.value; } @Override public String getAlgorithm() { return this.algorithm; } /** * parseKey *

The parse key method.

* @param key {@link java.lang.Integer}

The key parameter is Integer type.

* @return {@link io.github.nichetoolkit.rest.worker.sha.ShaAlgorithm}

The parse key return object is ShaAlgorithm type.

* @see java.lang.Integer * @see org.springframework.lang.NonNull * @see com.fasterxml.jackson.annotation.JsonCreator */ @JsonCreator public static ShaAlgorithm parseKey(@NonNull Integer key) { ShaAlgorithm typeEnum = RestValue.parseKey(ShaAlgorithm.class, key); return Optional.ofNullable(typeEnum).orElse(ShaAlgorithm.SHA256); } /** * parseValue *

The parse value method.

* @param value {@link java.lang.String}

The value parameter is String type.

* @return {@link io.github.nichetoolkit.rest.worker.sha.ShaAlgorithm}

The parse value return object is ShaAlgorithm type.

* @see java.lang.String * @see org.springframework.lang.NonNull */ public static ShaAlgorithm parseValue(@NonNull String value) { ShaAlgorithm typeEnum = RestValue.parseValue(ShaAlgorithm.class, value); return Optional.ofNullable(typeEnum).orElse(ShaAlgorithm.SHA256); } /** * parseAlgorithm *

The parse algorithm method.

* @param algorithm {@link java.lang.String}

The algorithm parameter is String type.

* @return {@link io.github.nichetoolkit.rest.worker.sha.ShaAlgorithm}

The parse algorithm return object is ShaAlgorithm type.

* @see java.lang.String * @see org.springframework.lang.NonNull */ public static ShaAlgorithm parseAlgorithm(@NonNull String algorithm) { ShaAlgorithm typeEnum = RestAlgorithm.parseAlgorithm(ShaAlgorithm.class, algorithm); return Optional.ofNullable(typeEnum).orElse(ShaAlgorithm.SHA256); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy