001 002package com.commercetools.history.models.common; 003 004import java.util.Arrays; 005import java.util.Optional; 006 007import com.fasterxml.jackson.annotation.JsonCreator; 008import com.fasterxml.jackson.annotation.JsonValue; 009 010import io.vrap.rmf.base.client.JsonEnum; 011import io.vrap.rmf.base.client.utils.Generated; 012 013/** 014 * ShippingRateTierType 015 */ 016@Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") 017public interface ShippingRateTierType extends JsonEnum { 018 019 ShippingRateTierType CART_VALUE = ShippingRateTierTypeEnum.CART_VALUE; 020 021 ShippingRateTierType CART_CLASSIFICATION = ShippingRateTierTypeEnum.CART_CLASSIFICATION; 022 023 ShippingRateTierType CART_SCORE = ShippingRateTierTypeEnum.CART_SCORE; 024 025 /** 026 * possible values of ShippingRateTierType 027 */ 028 enum ShippingRateTierTypeEnum implements ShippingRateTierType { 029 /** 030 * CartValue 031 */ 032 CART_VALUE("CartValue"), 033 034 /** 035 * CartClassification 036 */ 037 CART_CLASSIFICATION("CartClassification"), 038 039 /** 040 * CartScore 041 */ 042 CART_SCORE("CartScore"); 043 private final String jsonName; 044 045 private ShippingRateTierTypeEnum(final String jsonName) { 046 this.jsonName = jsonName; 047 } 048 049 public String getJsonName() { 050 return jsonName; 051 } 052 053 public String toString() { 054 return jsonName; 055 } 056 } 057 058 /** 059 * the JSON value 060 * @return json value 061 */ 062 @JsonValue 063 String getJsonName(); 064 065 /** 066 * the enum value 067 * @return name 068 */ 069 String name(); 070 071 /** 072 * convert value to string 073 * @return string representation 074 */ 075 String toString(); 076 077 /** 078 * factory method for a enum value of ShippingRateTierType 079 * if no enum has been found an anonymous instance will be created 080 * @param value the enum value to be wrapped 081 * @return enum instance 082 */ 083 @JsonCreator 084 public static ShippingRateTierType findEnum(String value) { 085 return findEnumViaJsonName(value).orElse(new ShippingRateTierType() { 086 @Override 087 public String getJsonName() { 088 return value; 089 } 090 091 @Override 092 public String name() { 093 return value.toUpperCase(); 094 } 095 096 public String toString() { 097 return value; 098 } 099 }); 100 } 101 102 /** 103 * method to find enum using the JSON value 104 * @param jsonName the json value to be wrapped 105 * @return optional of enum instance 106 */ 107 public static Optional<ShippingRateTierType> findEnumViaJsonName(String jsonName) { 108 return Arrays.stream(values()).filter(t -> t.getJsonName().equals(jsonName)).findFirst(); 109 } 110 111 /** 112 * possible enum values 113 * @return array of possible enum values 114 */ 115 public static ShippingRateTierType[] values() { 116 return ShippingRateTierTypeEnum.values(); 117 } 118 119}