/** * Initialize the JacksonProvider with a custom ObjectMapper. * @param objectMapper the ObjectMapper to use */ public JacksonJsonProvider(ObjectMapper objectMapper) { this(objectMapper, objectMapper.reader().withType(Object.class)); }
@Override public Object run() throws Exception { return reader.withType(genericType).readValue(jp); } });
/** * Initialize the JacksonProvider with a custom ObjectMapper. * @param objectMapper the ObjectMapper to use */ public JacksonJsonProvider(ObjectMapper objectMapper) { this(objectMapper, objectMapper.reader().withType(Object.class)); }
try { if (System.getSecurityManager() == null) { result = reader.withType(genericType).readValue(jp); } else { result = AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
@Override public ObjectReader load(Class<?> key) throws Exception { return objectReader.withType(key); } });
public CachedData(Path path, String name, ObjectMapper mapper, ParameterizedType valueType, boolean reloadOnChange) { this.dataPath = path; this.name = name; this.reader = mapper.reader().withType(valueType); this.reloadOnChange = reloadOnChange; }
@Override public Object run() throws Exception { return reader.withType(genericType).readValue(jp); } });
/** * Initialize the JacksonProvider with a custom ObjectMapper. * @param objectMapper the ObjectMapper to use */ public JacksonJsonProvider(ObjectMapper objectMapper) { this(objectMapper, objectMapper.reader().withType(Object.class)); }
/** * Type-safe overloaded method, basically alias for {@link #readValue(JsonParser, ResolvedType)}. *<p> * NOTE: this method never tries to auto-detect format, since actual * (data-format specific) parser is given. */ @SuppressWarnings("unchecked") public <T> T readValue(JsonParser jp, JavaType valueType) throws IOException, JsonProcessingException { return (T) withType(valueType).readValue(jp); }
/** * Type-safe overloaded method, basically alias for {@link #readValue(JsonParser, ResolvedType)}. *<p> * NOTE: this method never tries to auto-detect format, since actual * (data-format specific) parser is given. */ @SuppressWarnings("unchecked") public <T> T readValue(JsonParser jp, JavaType valueType) throws IOException, JsonProcessingException { return (T) withType(valueType).readValue(jp); }
/** * Type-safe overloaded method, basically alias for {@link #readValue(JsonParser, ResolvedType)}. *<p> * NOTE: this method never tries to auto-detect format, since actual * (data-format specific) parser is given. */ @SuppressWarnings("unchecked") public <T> T readValue(JsonParser jp, JavaType valueType) throws IOException, JsonProcessingException { return (T) withType(valueType).readValue(jp); }
/** * Method for constructing a new reader instance that is configured * to data bind into specified type. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectReader withType(java.lang.reflect.Type valueType) { return withType(_config.getTypeFactory().constructType(valueType)); }
/** * Method for constructing a new reader instance that is configured * to data bind into specified type. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectReader withType(Class<?> valueType) { return withType(_config.constructType(valueType)); }
public DataFormatReaders withType(JavaType type) { final int len = _readers.length; ObjectReader[] r = new ObjectReader[len]; for (int i = 0; i < len; ++i) { r[i] = _readers[i].withType(type); } return new DataFormatReaders(r, _optimalMatch, _minimalMatch, _maxInputLookahead); }
/** * Convenience method that is equivalent to: *<pre> * withType(valueType).readValues(jp); *</pre> *<p> * NOTE: this method never tries to auto-detect format, since actual * (data-format specific) parser is given. */ public <T> Iterator<T> readValues(JsonParser jp, JavaType valueType) throws IOException, JsonProcessingException { return withType(valueType).readValues(jp); }
/** * Convenience method that is equivalent to: *<pre> * withType(valueType).readValues(jp); *</pre> *<p> * NOTE: this method never tries to auto-detect format, since actual * (data-format specific) parser is given. */ public <T> Iterator<T> readValues(JsonParser jp, JavaType valueType) throws IOException, JsonProcessingException { return withType(valueType).readValues(jp); }
/** * Method for constructing a new reader instance that is configured * to data bind into specified type. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectReader withType(java.lang.reflect.Type valueType) { return withType(_config.getTypeFactory().constructType(valueType)); }
/** * Method for constructing a new reader instance that is configured * to data bind into specified type. *<p> * Note that the method does NOT change state of this reader, but * rather construct and returns a newly configured instance. */ public ObjectReader withType(TypeReference<?> valueTypeRef) { return withType(_config.getTypeFactory().constructType(valueTypeRef.getType())); }
protected JsonPatchOperationTest(final String prefix) throws IOException { final String resource = "/jsonpatch/" + prefix + ".json"; final JsonNode node = JsonLoader.fromResource(resource); errors = node.get("errors"); ops = node.get("ops"); reader = JacksonUtils.getReader().withType(JsonPatchOperation.class); }
public JacksonColumnMapper() { final ObjectMapper mapper; try { final ObjectMapperFactoryBean omfb = new ObjectMapperFactoryBean(); omfb.afterPropertiesSet(); mapper = omfb.getObject(); } catch (Exception e) { throw new RuntimeException("Failed to create ObjectMapper", e); } customizeObjectMapper(mapper); this.objectWriter = this.createObjectWriter(mapper).withType(JsonWrapper.class); this.objectReader = this.createObjectReader(mapper).withType(JsonWrapper.class); }