static void smartSet(Field f, O o, O value) throws Exception { try { f.set(o, value); } catch (Exception e) { Class type = f.getType(); // take care of common case (long to int) if (type == int.class && value instanceof Long) ret with f.set(o, ((Long) value).intValue()); if (type == bool.class && value instanceof S) ret with f.set(o, isTrueOrYes(value/S)); if (type == LinkedHashMap.class && value instanceof Map) ret with f.set(o, asLinkedHashMap((Map) value)); ifclass Concept try { if (f.getType() == Concept.Ref.class) ret with f.set(o, ((Concept) o).new Ref((Concept) value)); if (o instanceof Concept.Ref) ret with f.set(o, ((Concept.Ref) o).get()); } catch {} endif throw e; } }