if (match == 0) {
throw new UnmarshallException("bean has no matches");
}
// create a concrete ObjectMatch that is always returned in order to satisfy circular reference requirements
ObjectMatch returnValue = new ObjectMatch(-1);
state.setSerialized(o, returnValue);
ObjectMatch m = null;
ObjectMatch tmp;
i = jso.keys();
while (i.hasNext()) {
String field = (String) i.next();
Method setMethod = (Method) bd.writableProps.get(field);
if (setMethod != null) {
try {
Class param[] = setMethod.getParameterTypes();
if (param.length != 1) {
throw new UnmarshallException("bean " + clazz.getName() + " method " + setMethod.getName() + " does not have one arg");
}
tmp = _ser.tryUnmarshall(state, param[0], jso.get(field));
if (tmp != null) {
if (m == null) {
m = tmp;
} else {
m = m.max(tmp);
}
}
} catch (UnmarshallException e) {
throw new UnmarshallException("bean " + clazz.getName() + " " + e.getMessage(), e);
} catch (JSONException e) {
throw new UnmarshallException("bean " + clazz.getName() + " " + e.getMessage(), e);
}
} else {
mismatch++;
}
}
if (m != null) {
returnValue.setMismatch(m.max(new ObjectMatch(mismatch)).getMismatch());
} else {
returnValue.setMismatch(mismatch);
}
return returnValue;
}