예제 #1
0
  @Override
  public String marshall(List<ItemType> itemTypeList) {
    if (itemTypeList == null || itemTypeList.size() == 0) {
      return Item.EMPTY_ITEM_TYPE;
    }

    StringBuilder sb = new StringBuilder();
    for (ItemType type : itemTypeList) {
      sb.append(type.name() + ",");
    }
    return sb.toString();
  }
예제 #2
0
  @Override
  public List<ItemType> unmarshall(Class<List<ItemType>> clazz, String itemTypeList) {
    if (Item.EMPTY_ITEM_TYPE.equals(itemTypeList)) {
      return null;
    }

    List<ItemType> types = new ArrayList<>();
    String[] parts = itemTypeList.split(",");
    for (String p : parts) {
      types.add(ItemType.fromString(p));
    }
    return types;
  }