private void setChildValue(
      Instance dest,
      Instance src,
      AIField field,
      Function<Instance, Instance> oldFunction,
      boolean isInput) {
    Object value = src._get(field.getName()).getValue();
    if (field.getType().isCollection()) {
      @SuppressWarnings("unchecked")
      List<Instance> coll = (List<Instance>) value;
      List<Instance> result = new ArrayList<Instance>();
      coll.forEach(i -> result.add(getChanges(i, oldFunction, isInput)));
      value = result;
    } else {
      // Simply clone value with changed properties
      if (value != null) {
        value = cloneSingleChildValue((Instance) value, dest, field, oldFunction, isInput);
      }
    }

    dest._set(field.getName(), value);
  }
예제 #2
0
 @Override
 public Object eval(
     AIField p, EScriptContext scriptContext, AModelType mType, Object existingValue) {
   AType type = p.getType();
   return System.getEnumValue(type.getNamespace(), type.getName(), enumValue.getName());
 }