/** * Construct from serialized parameters, presented in the binder instance * * @param fields binder with named parameters (case sensitive field names, like haveCopy or createdAt) */ public ItemResult(Binder fields) { state = ItemState.valueOf(fields.getStringOrThrow("state")); haveCopy = fields.getBooleanOrThrow("haveCopy"); createdAt = fields.getZonedDateTime("createdAt", null); expiresAt = fields.getZonedDateTime("expiresAt", null); errors = new ArrayList<>(); fields.getList("errors", Collections.EMPTY_LIST).forEach(x -> { errors.add( x instanceof Binder ? new ErrorRecord((Binder)x) : (ErrorRecord) x); }); isTestnet = fields.getBoolean("isTestnet",false); lockedById = (HashId) fields.get("lockedById"); extraDataBinder = fields.getBinder("extra", new Binder()); }