@Override public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { // couple of accepted types... Object value; if (_inputType == null) { value = jp.getText(); } else if (_inputType == Integer.class) { value = Integer.valueOf(jp.getValueAsInt()); } else if (_inputType == Long.class) { value = Long.valueOf(jp.getValueAsLong()); } else { throw ctxt.mappingException(_enumClass); } try { return _factory.invoke(_enumClass, value); } catch (Exception e) { ClassUtil.unwrapAndThrowAsIAE(e); } return null; }