com.paypal.sdk.models.PayPalPaymentTokenUsagePattern Maven / Gradle / Ivy
/*
* PaypalServerSDKLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
package com.paypal.sdk.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;
/**
* PayPalPaymentTokenUsagePattern to be used.
*/
public enum PayPalPaymentTokenUsagePattern {
IMMEDIATE,
DEFERRED,
RECURRING_PREPAID,
RECURRING_POSTPAID,
THRESHOLD_PREPAID,
THRESHOLD_POSTPAID,
/**
* Unknown values will be mapped by this enum member
*/
_UNKNOWN;
private static TreeMap valueMap = new TreeMap<>();
private String value;
static {
IMMEDIATE.value = "IMMEDIATE";
DEFERRED.value = "DEFERRED";
RECURRING_PREPAID.value = "RECURRING_PREPAID";
RECURRING_POSTPAID.value = "RECURRING_POSTPAID";
THRESHOLD_PREPAID.value = "THRESHOLD_PREPAID";
THRESHOLD_POSTPAID.value = "THRESHOLD_POSTPAID";
_UNKNOWN.value = null;
valueMap.put("IMMEDIATE", IMMEDIATE);
valueMap.put("DEFERRED", DEFERRED);
valueMap.put("RECURRING_PREPAID", RECURRING_PREPAID);
valueMap.put("RECURRING_POSTPAID", RECURRING_POSTPAID);
valueMap.put("THRESHOLD_PREPAID", THRESHOLD_PREPAID);
valueMap.put("THRESHOLD_POSTPAID", THRESHOLD_POSTPAID);
}
/**
* Returns the enum member associated with the given string value.
* @param toConvert String value to get enum member.
* @return The enum member against the given string value.
* @throws IOException when provided value is not mapped to any enum member.
*/
@JsonCreator
public static PayPalPaymentTokenUsagePattern constructFromString(String toConvert) throws IOException {
PayPalPaymentTokenUsagePattern enumValue = fromString(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 string value.
* @param toConvert String value to get enum member.
* @return The enum member against the given string value.
*/
public static PayPalPaymentTokenUsagePattern fromString(String toConvert) {
if (!valueMap.containsKey(toConvert)) {
return _UNKNOWN;
}
return valueMap.get(toConvert);
}
/**
* Returns the string value associated with the enum member.
* @return The string value against enum member.
*/
@JsonValue
public String value() {
return value;
}
/**
* Get string representation of this enum.
*/
@Override
public String toString() {
if (value == null) {
return null;
}
return value.toString();
}
/**
* Convert list of PayPalPaymentTokenUsagePattern values to list of string values.
* @param toConvert The list of PayPalPaymentTokenUsagePattern values to convert.
* @return List of representative string values.
*/
public static List toValue(List toConvert) {
if (toConvert == null) {
return null;
}
List convertedValues = new ArrayList<>();
for (PayPalPaymentTokenUsagePattern enumValue : toConvert) {
convertedValues.add(enumValue.value);
}
return convertedValues;
}
}