/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = _deserializerProvider.findTypedValueDeserializer(cfg, valueType, null); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // Sanity check: must have actual type... if (valueType == null) { throw new JsonMappingException("No value type configured for ObjectReader"); } // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = _provider.findTypedValueDeserializer(cfg, valueType, null); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // Sanity check: must have actual type... if (valueType == null) { throw new JsonMappingException("No value type configured for ObjectReader"); } // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // es-hadoop: findType with 2 args have been removed since 1.9 so this code compiles on 1.8 (which has the fallback method) // es-hadoop: on 1.5 only the 2 args method exists, since 1.9 only the one with 3 args hence the if // Nope: need to ask provider to resolve it deser = _provider.findTypedValueDeserializer(cfg, valueType); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type " + valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = _deserializerProvider.findTypedValueDeserializer(cfg, valueType, null); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // Sanity check: must have actual type... if (valueType == null) { throw new JsonMappingException("No value type configured for ObjectReader"); } // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = _provider.findTypedValueDeserializer(cfg, valueType, null); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Deprecated version of accessor method that was used before version 1.7. * Implemented as final to ensure that existing code does not accidentally * try to redefine it (given that it is not called by core mapper code) * * @deprecated As of version 1.7, use version that exposes context class * and property, instead of just types */ @Deprecated public final JsonDeserializer<Object> findTypedValueDeserializer(DeserializationConfig config, JavaType type) throws JsonMappingException { return findTypedValueDeserializer(config, type, null); }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = _provider.findTypedValueDeserializer(cfg, valueType, null); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = _provider.findTypedValueDeserializer(cfg, valueType, null); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = _deserializerProvider.findTypedValueDeserializer(cfg, valueType, null); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = _deserializerProvider.findTypedValueDeserializer(cfg, valueType, null); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = _deserializerProvider.findTypedValueDeserializer(cfg, valueType, null); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // Sanity check: must have actual type... if (valueType == null) { throw new JsonMappingException("No value type configured for ObjectReader"); } // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // es-hadoop: findType with 2 args have been removed since 1.9 so this code compiles on 1.8 (which has the fallback method) // es-hadoop: on 1.5 only the 2 args method exists, since 1.9 only the one with 3 args hence the if // Nope: need to ask provider to resolve it deser = _provider.findTypedValueDeserializer(cfg, valueType); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type " + valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // Sanity check: must have actual type... if (valueType == null) { throw new JsonMappingException("No value type configured for ObjectReader"); } // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // es-hadoop: findType with 2 args have been removed since 1.9 so this code compiles on 1.8 (which has the fallback method) // es-hadoop: on 1.5 only the 2 args method exists, since 1.9 only the one with 3 args hence the if // Nope: need to ask provider to resolve it deser = _provider.findTypedValueDeserializer(cfg, valueType); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type " + valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // Sanity check: must have actual type... if (valueType == null) { throw new JsonMappingException("No value type configured for ObjectReader"); } // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // Nope: need to ask provider to resolve it deser = _provider.findTypedValueDeserializer(cfg, valueType, null); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type "+valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // Sanity check: must have actual type... if (valueType == null) { throw new JsonMappingException("No value type configured for ObjectReader"); } // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // es-hadoop: findType with 2 args have been removed since 1.9 so this code compiles on 1.8 (which has the fallback method) // es-hadoop: on 1.5 only the 2 args method exists, since 1.9 only the one with 3 args hence the if // Nope: need to ask provider to resolve it deser = _provider.findTypedValueDeserializer(cfg, valueType); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type " + valueType); } _rootDeserializers.put(valueType, deser); return deser; }
/** * Method called to locate deserializer for the passed root-level value. */ protected JsonDeserializer<Object> _findRootDeserializer(DeserializationConfig cfg, JavaType valueType) throws JsonMappingException { // Sanity check: must have actual type... if (valueType == null) { throw new JsonMappingException("No value type configured for ObjectReader"); } // First: have we already seen it? JsonDeserializer<Object> deser = _rootDeserializers.get(valueType); if (deser != null) { return deser; } // es-hadoop: findType with 2 args have been removed since 1.9 so this code compiles on 1.8 (which has the fallback method) // es-hadoop: on 1.5 only the 2 args method exists, since 1.9 only the one with 3 args hence the if // Nope: need to ask provider to resolve it deser = _provider.findTypedValueDeserializer(cfg, valueType); if (deser == null) { // can this happen? throw new JsonMappingException("Can not find a deserializer for type " + valueType); } _rootDeserializers.put(valueType, deser); return deser; }
private static <K> BeanProperty getBeanProperty(ObjectMapper objectMapper, Class klass, Class<K> type) throws JsonMappingException { JsonDeserializer deserializer = objectMapper.getDeserializerProvider().findTypedValueDeserializer( objectMapper.copyDeserializationConfig(), SimpleType.construct(klass), null); if (deserializer instanceof BeanDeserializer) { // First priority is a property creator, see if one exists Object propertyBasedCreator = privateGet(deserializer, "_propertyBasedCreator"); if (propertyBasedCreator != null) { Map<String, SettableBeanProperty> properties = (Map) privateGet(propertyBasedCreator, "_properties"); SettableBeanProperty beanProperty = properties.get("_id"); if (beanProperty != null) { checkType(type, beanProperty.getType().getRawClass()); return beanProperty; } } // Now try setters Iterator<SettableBeanProperty> iter = ((BeanDeserializer) deserializer).properties(); while (iter.hasNext()) { SettableBeanProperty beanProperty = iter.next(); if (beanProperty.getName().equals("_id")) { checkType(type, beanProperty.getType().getRawClass()); return beanProperty; } } } return null; }
private static <K> BeanProperty getBeanProperty(ObjectMapper objectMapper, Class klass, Class<K> type) throws JsonMappingException { JsonDeserializer deserializer = objectMapper.getDeserializerProvider().findTypedValueDeserializer( objectMapper.copyDeserializationConfig(), SimpleType.construct(klass), null); if (deserializer instanceof BeanDeserializer) { // First priority is a property creator, see if one exists Object propertyBasedCreator = privateGet(deserializer, "_propertyBasedCreator"); if (propertyBasedCreator != null) { Map<String, SettableBeanProperty> properties = (Map) privateGet(propertyBasedCreator, "_properties"); SettableBeanProperty beanProperty = properties.get("_id"); if (beanProperty != null) { checkType(type, beanProperty.getType().getRawClass()); return beanProperty; } } // Now try setters Iterator<SettableBeanProperty> iter = ((BeanDeserializer) deserializer).properties(); while (iter.hasNext()) { SettableBeanProperty beanProperty = iter.next(); if (beanProperty.getName().equals("_id")) { checkType(type, beanProperty.getType().getRawClass()); return beanProperty; } } } return null; }