static void zeroAllFieldsOfTypeExcept(O o, Class type, S... exceptions) { zeroAllFieldsOfTypeExcept(o, type, asSet(exceptions)); } static void zeroAllFieldsOfTypeExcept(O o, Class type, Collection exceptions) { Set set = asSet(exceptions); for (S field : allFields(o)) if (!set.contains(field) && instanceOf(getOpt(o, field), type)) set(o, field, null); }