static A resetFields(A object, S fields) { if (object != null) { O emptyInstance = newInstance(object.getClass()); for (S field : identifiers(fields)) setOpt(object, field, getOpt(emptyInstance, field)); } ret object; }