package com.vans.ods.constants;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.room.TypeConverter;
import com.google.gson.annotations.SerializedName;
public enum ServiceCode {
@SerializedName("DONG")
DONG("DONG"), // 동반성장 설치확인서
@SerializedName("KAKAOPAY")
KAKAOPAY("KAKAOPAY"), //카카오페이
EMPTY(""); //
private String code;
ServiceCode(String code) {
this.code = code;
}
public String getCode() {
return code;
}
public boolean equals(String type) {
return this.code.equalsIgnoreCase(type);
}
@NonNull
@TypeConverter
public static ServiceCode toVanCodeType(@Nullable String serviceCode) {
if (serviceCode == null) {
return EMPTY;
}
for (ServiceCode value : ServiceCode.values()) {
if (value.equals(serviceCode)) {
return value;
}
}
return EMPTY;
}
@NonNull
@TypeConverter
public static String toString(@Nullable VanCode vanCode) {
return vanCode == null ? EMPTY.getCode() : vanCode.getCode();
}
}
반응형
'Platform > Android' 카테고리의 다른 글
아키텍처 (0) | 2020.07.31 |
---|---|
[INTENT] URL 로 Activity 호출 (0) | 2020.07.23 |
[구글플레이 설치] (0) | 2020.07.14 |
[xml 투명도] (0) | 2020.07.14 |
touch inset (0) | 2020.07.14 |