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

com.shell.apitest.models.CardDetailAutoRenewEnum Maven / Gradle / Ivy

/*
 * ShellCardManagementAPIsLib
 *
 * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
 */

package com.shell.apitest.models;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.TreeMap;


/**
 * CardDetailAutoRenewEnum to be used.
 */
public enum CardDetailAutoRenewEnum {
    ENUM_1,

    ENUM_2,

    ENUM_3;


    private static TreeMap valueMap = new TreeMap<>();
    private Integer value;

    static {
        ENUM_1.value = 1;
        ENUM_2.value = 2;
        ENUM_3.value = 3;

        valueMap.put(1, ENUM_1);
        valueMap.put(2, ENUM_2);
        valueMap.put(3, ENUM_3);
    }

    /**
     * Returns the enum member associated with the given integer value.
     * @param toConvert String value to get enum member.
     * @return The enum member against the given integer value.
     * @throws IOException when provided value is not mapped to any enum member.
     */
    @JsonCreator
    public static CardDetailAutoRenewEnum constructFromInteger(Integer toConvert) throws IOException {
        CardDetailAutoRenewEnum enumValue = fromInteger(toConvert);
        if (enumValue == null) {
            throw new IOException("Unable to create enum instance with value: " + toConvert);
        }
        return enumValue;
    }

    /**
     * Returns the enum member associated with the given integer value.
     * @param toConvert String value to get enum member.
     * @return The enum member against the given integer value.
     */
    public static CardDetailAutoRenewEnum fromInteger(Integer toConvert) {
        return valueMap.get(toConvert);
    }

    /**
     * Returns the integer value associated with the enum member.
     * @return The integer value against enum member.
     */
    @JsonValue
    public Integer value() {
        return value;
    }
        
    /**
     * Get string representation of this enum.
     */
    @Override
    public String toString() {
        return value.toString();
    }

    /**
     * Convert list of CardDetailAutoRenewEnum values to list of integer values.
     * @param toConvert The list of CardDetailAutoRenewEnum values to convert.
     * @return List of representative integer values.
     */
    public static List toValue(List toConvert) {
        if (toConvert == null) {
            return null;
        }
        List convertedValues = new ArrayList<>();
        for (CardDetailAutoRenewEnum enumValue : toConvert) {
            convertedValues.add(enumValue.value);
        }
        return convertedValues;
    }
} 




© 2015 - 2024 Weber Informatics LLC | Privacy Policy