列挙型を使用しているJavaオブジェクトが1つあります
public class Deal{
public enum PriceType {
fixed, hour, month, year
}
@Element(name = "price-type", required = false)
private PriceType priceType;
}
このオブジェクトはいくつかの API から取り込まれ、文字列型変数を持つデータベース オブジェクトでこれを取得しています
MyDeal{
private String priceType;
public String getPriceType() {
return priceType;
}
public void setPriceType(String priceType) {
this.priceType = priceType == null ? null : priceType.trim();
}
}
データベース オブジェクトを次のように設定できないのはなぜですか
List<Deal>deals = dealResource.getAll();
MyDeal myDeal = new myDeal();
for (Deal deal : deals) {
myDeal.setPriceType(deal.getPriceType());
}