private Order convert()

in src/main/java/com/amazonaws/dao/OrderDao.java [228:270]


    private Order convert(final Map<String, AttributeValue> item) {
        if (item == null || item.isEmpty()) {
            return null;
        }
        Order.OrderBuilder builder = Order.builder();

        try {
            builder.orderId(item.get(ORDER_ID).s());
        } catch (NullPointerException e) {
            throw new IllegalStateException(
                    "item did not have an orderId attribute or it was not a String");
        }

        try {
            builder.customerId(item.get("customerId").s());
        } catch (NullPointerException e) {
            throw new IllegalStateException(
                    "item did not have an customerId attribute or it was not a String");
        }

        try {
            builder.preTaxAmount(new BigDecimal(item.get("preTaxAmount").n()));
        } catch (NullPointerException | NumberFormatException e) {
            throw new IllegalStateException(
                    "item did not have an preTaxAmount attribute or it was not a Number");
        }

        try {
            builder.postTaxAmount(new BigDecimal(item.get("postTaxAmount").n()));
        } catch (NullPointerException | NumberFormatException e) {
            throw new IllegalStateException(
                    "item did not have an postTaxAmount attribute or it was not a Number");
        }

        try {
            builder.version(Long.valueOf(item.get("version").n()));
        } catch (NullPointerException | NumberFormatException e) {
            throw new IllegalStateException(
                    "item did not have an version attribute or it was not a Number");
        }

        return builder.build();
    }