Пример #1
0
 JsonValue distillOp(FullSpec spec, JsonValue val) {
   if (this.version == null
       || this.version.compareTo(spec.getVersion().toString()) < 0) { // TODO check condition
     return val; // no concurrent op
   }
   VersionOpSpec opkey = spec.getVersionOp();
   this.oplog.put(opkey, val);
   this.distillLog(); // may amend the value
   val = this.oplog.get(opkey);
   return (val == null ? JsonValue.NULL : val);
 }
Пример #2
0
 @Override
 public String validate(FullSpec spec, JsonValue val) {
   if (!CHANGE.equals(spec.getOp())) {
     return VALID;
   }
   if (val.isObject()) {
     JsonObject jo = (JsonObject) val;
     for (String keySpecStr : jo.names()) {
       // member spec validity
       try {
         new TypeIdSpec(keySpecStr);
       } catch (IllegalArgumentException e) {
         return "invalid spec: " + keySpecStr;
       }
     }
   }
   return VALID;
 }