Commit 565eda6f authored by BertTowne's avatar BertTowne

Add new TypeAdapter for ShopPackageCondition Types

parent eb328cb4
......@@ -39,6 +39,8 @@ public class CubedPayAPI {
Transaction.Status.findById(json.getAsString()))
.registerTypeAdapter(SupportTicket.Status.class, (JsonDeserializer<SupportTicket.Status>) (json, typeOfT, context) ->
SupportTicket.Status.findById(json.getAsString()))
.registerTypeAdapter(ShopPackageCondition.Type.class, (JsonDeserializer<ShopPackageCondition.Type>) (json, typeOfT, context) ->
ShopPackageCondition.Type.findById(json.getAsString()))
.registerTypeAdapter(ShopSidebarModule.Side.class, (JsonDeserializer<ShopSidebarModule.Side>) (json, typeOfT, context) ->
ShopSidebarModule.Side.findById(json.getAsString()))
.registerTypeAdapter(ShopSidebarModule.Type.class, (JsonDeserializer<ShopSidebarModule.Type>) (json, typeOfT, context) ->
......
package co.melondev.cubedpay.data;
import java.util.Arrays;
public class ShopPackageCondition {
public enum Type {
BROUGHT_ANY,
BROUGHT;
BROUGHT_ANY, BROUGHT
public static Type findById(String id) {
return Arrays.stream(values()).filter(type -> type.name().equalsIgnoreCase(id))
.findFirst().orElse(null);
}
}
private String id;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment