1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
| import com.google.common.collect.Maps; import lombok.Getter; import lombok.RequiredArgsConstructor;
import java.util.Arrays; import java.util.Map;
@RequiredArgsConstructor @Getter public enum PayMethodEnum {
CARDS(0),
BANK_DEBITS(1),
BANK_REDIRECTS(2),
BANK_TRANSFERS(3),
PAY_LATER(4),
VOUCHERS(5),
WALLETS(6);
private final int code; public static final Map<Integer, PayMethodEnum> MAP = Maps.newHashMapWithExpectedSize(PayMethodEnum.values().length);
static { Arrays.stream(PayMethodEnum.values()).forEach(aEnum -> MAP.put(aEnum.getCode(), aEnum) ); }
public static PayMethodEnum valueOfCode(int code) { return MAP.get(code); }
}
|