Skip to content

Instantly share code, notes, and snippets.

@shlee0882
Created March 7, 2021 11:49
package com.shlee.toy1.repository.product.type;
public enum ProductVersionType {
VERSION1("1_VERSION", "VAL1"),
VERSION2("2_VERSION", "VAL2");
public String code;
public String value;
private ProductVersionType(String code, String value) {
this.code = code;
this.value = value;
}
public String getCode() {
return code;
}
public String getValue() {
return value;
}
public static ProductVersionType get(String code) {
for (ProductVersionType element : values()) {
if (element.code.equalsIgnoreCase(code)) {
return element;
}
}
return null;
}
public static ProductVersionType lookup(String code) {
for (ProductVersionType element : ProductVersionType.values()) {
if (element.code.equalsIgnoreCase(code)) {
return element;
}
}
return null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment