}
protected Object _readBean(Class<?> type, int typeId) throws IOException
{
if (typeId < 0) { // actual bean types
BeanDefinition def = _typeDetector.getBeanDefinition(typeId);
JsonToken t = _parser.getCurrentToken();
try {
Object bean = null;
switch (t) {
case VALUE_STRING:
bean = def.create(_parser.getText());
break;
case VALUE_NUMBER_INT:
bean = def.create(_parser.getLongValue());
break;
case START_OBJECT:
{
bean = def.create();
for (; (t = _parser.nextToken()) == JsonToken.FIELD_NAME; ) {
String fieldName = _parser.getCurrentName();
BeanProperty prop = def.findProperty(fieldName);
if (prop == null) {
if (JSON.Feature.FAIL_ON_UNKNOWN_BEAN_PROPERTY.isEnabled(_features)) {
throw JSONObjectException.from(_parser, "Unrecognized JSON property '"
+fieldName+"' for Bean type "+type.getName());
}