org.codehaus.jackson.map.DeserializationConfig Java Examples
The following examples show how to use
org.codehaus.jackson.map.DeserializationConfig.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectService.java From jira-rest-client with Apache License 2.0 | 6 votes |
public List<Project> getProjectList() throws IOException { if (client == null) throw new IllegalStateException("HTTP Client not Initailized"); client.setResourceName(Constants.JIRA_RESOURCE_PROJECT); ClientResponse response = client.get(); String content = response.getEntity(String.class); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, true); TypeReference<List<Project>> ref = new TypeReference<List<Project>>(){}; List<Project> prj = mapper.readValue(content, ref); return prj; }
Example #2
Source File: BackportedObjectReader.java From elasticsearch-hadoop with Apache License 2.0 | 6 votes |
/** * 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; }
Example #3
Source File: StatePool.java From big-c with Apache License 2.0 | 6 votes |
private void read(DataInput in) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.configure( DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true); // define a module SimpleModule module = new SimpleModule("State Serializer", new Version(0, 1, 1, "FINAL")); // add the state deserializer module.addDeserializer(StatePair.class, new StateDeserializer()); // register the module with the object-mapper mapper.registerModule(module); JsonParser parser = mapper.getJsonFactory().createJsonParser((DataInputStream)in); StatePool statePool = mapper.readValue(parser, StatePool.class); this.setStates(statePool.getStates()); parser.close(); }
Example #4
Source File: JsonObjectMapperParser.java From RDFS with Apache License 2.0 | 6 votes |
/** * Constructor. * * @param path * Path to the JSON data file, possibly compressed. * @param conf * @throws IOException */ public JsonObjectMapperParser(Path path, Class<? extends T> clazz, Configuration conf) throws IOException { mapper = new ObjectMapper(); mapper.configure( DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true); this.clazz = clazz; FileSystem fs = path.getFileSystem(conf); CompressionCodec codec = new CompressionCodecFactory(conf).getCodec(path); InputStream input; if (codec == null) { input = fs.open(path); decompressor = null; } else { FSDataInputStream fsdis = fs.open(path); decompressor = CodecPool.getDecompressor(codec); input = codec.createInputStream(fsdis, decompressor); } jsonParser = mapper.getJsonFactory().createJsonParser(input); }
Example #5
Source File: StatePool.java From hadoop with Apache License 2.0 | 6 votes |
private void read(DataInput in) throws IOException { ObjectMapper mapper = new ObjectMapper(); mapper.configure( DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true); // define a module SimpleModule module = new SimpleModule("State Serializer", new Version(0, 1, 1, "FINAL")); // add the state deserializer module.addDeserializer(StatePair.class, new StateDeserializer()); // register the module with the object-mapper mapper.registerModule(module); JsonParser parser = mapper.getJsonFactory().createJsonParser((DataInputStream)in); StatePool statePool = mapper.readValue(parser, StatePool.class); this.setStates(statePool.getStates()); parser.close(); }
Example #6
Source File: JacksonPayloadSerializer.java From helix with Apache License 2.0 | 6 votes |
@Override public <T> T deserialize(final Class<T> clazz, final byte[] bytes) { if (bytes == null || bytes.length == 0) { return null; } ObjectMapper mapper = new ObjectMapper(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); DeserializationConfig deserializationConfig = mapper.getDeserializationConfig(); deserializationConfig.set(DeserializationConfig.Feature.AUTO_DETECT_FIELDS, true); deserializationConfig.set(DeserializationConfig.Feature.AUTO_DETECT_SETTERS, true); deserializationConfig.set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, true); try { T payload = mapper.readValue(bais, clazz); return payload; } catch (Exception e) { logger.error("Exception during deserialization of payload bytes: " + new String(bytes), e); return null; } }
Example #7
Source File: RedisMessageReceiver.java From onboard with Apache License 2.0 | 6 votes |
public void receiveMessage(String message) { LOGGER.info("Received <" + message + ">"); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { Activity activity = mapper.readValue(message, Activity.class); ArrayList<User> users = (ArrayList<User>) activity.getSubscribers(); if (users != null) { for (User user : users) { websocketHandler.sendMessage(user.getEmail(), message); } } } catch (IOException e) { LOGGER.info("message is not type of activity"); } }
Example #8
Source File: PropertyJsonSerializer.java From helix with Apache License 2.0 | 6 votes |
@Override public T deserialize(byte[] bytes) throws PropertyStoreException { ObjectMapper mapper = new ObjectMapper(); ByteArrayInputStream bais = new ByteArrayInputStream(bytes); DeserializationConfig deserializationConfig = mapper.getDeserializationConfig(); deserializationConfig.set(DeserializationConfig.Feature.AUTO_DETECT_FIELDS, true); deserializationConfig.set(DeserializationConfig.Feature.AUTO_DETECT_SETTERS, true); deserializationConfig.set(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, true); try { T value = mapper.readValue(bais, _clazz); return value; } catch (Exception e) { LOG.error("Error during deserialization of bytes: " + new String(bytes), e); } return null; }
Example #9
Source File: IssueService.java From jira-rest-client with Apache License 2.0 | 6 votes |
/** * Returns a list of all issue types visible to the user * * @return List list of IssueType * * @throws IOException json decoding failed */ public List<IssueType> getAllIssueTypes() throws IOException { client.setResourceName(Constants.JIRA_RESOURCE_ISSUETYPE); ClientResponse response = client.get(); String content = response.getEntity(String.class); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, true); TypeReference<List<IssueType>> ref = new TypeReference<List<IssueType>>() { }; List<IssueType> issueTypes = mapper.readValue(content, ref); return issueTypes; }
Example #10
Source File: IssueService.java From jira-rest-client with Apache License 2.0 | 6 votes |
public Issue getIssue(String issueKey) throws IOException { if (client == null) { throw new IllegalStateException("HTTP Client not Initailized"); } client.setResourceName(Constants.JIRA_RESOURCE_ISSUE + "/" + issueKey); ClientResponse response = client.get(); String content = response.getEntity(String.class); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, true); TypeReference<Issue> ref = new TypeReference<Issue>() { }; issue = mapper.readValue(content, ref); return issue; }
Example #11
Source File: ProjectService.java From jira-rest-client with Apache License 2.0 | 6 votes |
public Project getProjectDetail(String idOrKey) throws IOException { if (client == null) throw new IllegalStateException("HTTP Client not Initailized"); client.setResourceName(Constants.JIRA_RESOURCE_PROJECT + "/" + idOrKey); ClientResponse response = client.get(); String content = response.getEntity(String.class); ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, true); TypeReference<Project> ref = new TypeReference<Project>(){}; Project prj = mapper.readValue(content, ref); return prj; }
Example #12
Source File: TaskManagerEntityMapper.java From AIDR with GNU Affero General Public License v3.0 | 6 votes |
@Deprecated public <E> E deSerialize(String jsonString, Class<E> entityType) { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { if (jsonString != null) { System.out.println("received json string for deserialization: " + jsonString); E entity = mapper.readValue(jsonString, entityType); System.out.println("entity: " + entity); return entity; } } catch (Exception e) { logger.error("JSON deserialization exception",e); } return null; }
Example #13
Source File: TestJsonSerde.java From hraven with Apache License 2.0 | 5 votes |
@Test public void testJsonSerializationFlowStatsJobDetails() throws Exception { // load a sample flow final short numJobsAppOne = 3; final short numJobsAppTwo = 4; final long baseStats = 10L; Table historyTable = hbaseConnection.getTable(TableName.valueOf(Constants.HISTORY_TABLE)); GenerateFlowTestData flowDataGen = new GenerateFlowTestData(); flowDataGen.loadFlow("c1@local", "buser", "AppOne", 1234, "a", numJobsAppOne, baseStats, idService, historyTable); flowDataGen.loadFlow("c2@local", "Muser", "AppTwo", 2345, "b", numJobsAppTwo, baseStats, idService, historyTable); historyTable.close(); JobHistoryService service = new JobHistoryService(UTIL.getConfiguration(), hbaseConnection); List<Flow> actualFlows = service.getFlowTimeSeriesStats("c1@local", "buser", "AppOne", "", 0L, 0L, 1000, null); // serialize flows into json ObjectMapper om = ObjectMapperProvider.createCustomMapper(); om.configure(SerializationConfig.Feature.INDENT_OUTPUT, true); om.configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false); om.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); ByteArrayOutputStream f = new ByteArrayOutputStream(); om.writeValue(f, actualFlows); ByteArrayInputStream is = new ByteArrayInputStream(f.toByteArray()); @SuppressWarnings("unchecked") List<Flow> deserFlows = (List<Flow>) JSONUtil.readJson(is, new TypeReference<List<Flow>>() { }); assertFlowDetails(actualFlows, deserFlows); }
Example #14
Source File: TaggerServiceImpl.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@Override public List<TaggerCrisisType> getAllCrisisTypes() throws AidrException { Client client = ClientBuilder.newBuilder() .register(JacksonFeature.class).build(); try { /** * Rest call to Tagger */ logger.info("Received request to fetch all crisisTypes"); WebTarget webResource = client.target(taggerMainUrl + "/crisisType/all"); ObjectMapper objectMapper = JacksonWrapper.getObjectMapper(); objectMapper.configure( DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); Response clientResponse = webResource.request( MediaType.APPLICATION_JSON).get(); String jsonResponse = clientResponse.readEntity(String.class); //logger.error("URL: " + taggerMainUrl + " " + jsonResponse); TaggerAllCrisesTypesResponse crisesTypesResponse = objectMapper .readValue(jsonResponse, TaggerAllCrisesTypesResponse.class); if (crisesTypesResponse.getCrisisTypes() != null) { logger.info("Tagger returned " + crisesTypesResponse.getCrisisTypes().size() + " crises types"); } return crisesTypesResponse.getCrisisTypes(); } catch (Exception e) { logger.error("Error while getting all crisis from Tagger", e); throw new AidrException( "Error while getting all crisis from Tagger", e); } }
Example #15
Source File: JacksonWrapper.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
/** * Generates an {@link ObjectMapper} and configures it so that it does not fail on unknown properties. * * @return an object mapper. */ public static ObjectMapper getObjectMapper() { try { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); return objectMapper; } catch (Exception e) { logger.error("Exception in JacksonWrapper "+e.getStackTrace()); return null; } }
Example #16
Source File: TaggerServiceImpl.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@Override public TaggerResponseWrapper getHumanLabeledDocumentsByCrisisCode( String crisisCode, Integer count) throws AidrException { Client client = ClientBuilder.newBuilder() .register(JacksonFeature.class).build(); try { // Rest call to Tagger WebTarget webResource = client.target(taggerMainUrl + "/misc/humanLabeled/crisisCode/" + crisisCode + "?count=" + count); ObjectMapper objectMapper = JacksonWrapper.getObjectMapper(); objectMapper.configure( DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); Response clientResponse = webResource.request( MediaType.APPLICATION_JSON).get(); String jsonResponse = clientResponse.readEntity(String.class); TaggerResponseWrapper dtoList = objectMapper.readValue( jsonResponse, TaggerResponseWrapper.class); logger.info("Number of human labeled documents returned by Tagger: " + (dtoList.getHumanLabeledItems() != null ? dtoList .getHumanLabeledItems().size() : 0)); return dtoList; } catch (Exception e) { logger.error("Error while getting all human labeled documents for crisis code = " + crisisCode + " from Tagger", e); throw new AidrException( "Error while getting all human labeled documents for crisis code = " + crisisCode + " from Tagger", e); } }
Example #17
Source File: TaggerServiceImpl.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@Override public TaggerResponseWrapper getHumanLabeledDocumentsByCrisisIDUserID( Long crisisID, Long userID, Integer count) throws AidrException { Client client = ClientBuilder.newBuilder() .register(JacksonFeature.class).build(); try { // Rest call to Tagger WebTarget webResource = client.target(taggerMainUrl + "/misc/humanLabeled/crisisID/" + crisisID + "/userID/" + userID + "?count=" + count); ObjectMapper objectMapper = JacksonWrapper.getObjectMapper(); objectMapper.configure( DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); Response clientResponse = webResource.request( MediaType.APPLICATION_JSON).get(); String jsonResponse = clientResponse.readEntity(String.class); TaggerResponseWrapper dtoList = objectMapper.readValue( jsonResponse, TaggerResponseWrapper.class); logger.info("Number of human labeled documents returned by Tagger: " + (dtoList.getHumanLabeledItems() != null ? dtoList .getHumanLabeledItems().size() : 0)); return dtoList; } catch (Exception e) { logger.error("Error while getting all human labeled documents for crisisID = " + crisisID + ", userId = " + userID + " from Tagger", e); throw new AidrException( "Error while getting all human labeled documents for crisisID = " + crisisID + ", userId = " + userID + " from Tagger", e); } }
Example #18
Source File: TaggerServiceImpl.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@Override public TaggerResponseWrapper getHumanLabeledDocumentsByCrisisIDUserName( Long crisisID, String userName, Integer count) throws AidrException { Client client = ClientBuilder.newBuilder() .register(JacksonFeature.class).build(); try { // Rest call to Tagger WebTarget webResource = client.target(taggerMainUrl + "/misc/humanLabeled/crisisID/" + crisisID + "/userName/" + userName + "?count=" + count); ObjectMapper objectMapper = JacksonWrapper.getObjectMapper(); objectMapper.configure( DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); Response clientResponse = webResource.request( MediaType.APPLICATION_JSON).get(); String jsonResponse = clientResponse.readEntity(String.class); TaggerResponseWrapper dtoList = objectMapper.readValue( jsonResponse, TaggerResponseWrapper.class); logger.info("Number of human labeled documents returned by Tagger: " + (dtoList.getHumanLabeledItems() != null ? dtoList .getHumanLabeledItems().size() : 0)); return dtoList; } catch (Exception e) { logger.error("Error while getting all human labeled documents for crisisID = " + crisisID + ", user name = " + userName + " from Tagger", e); throw new AidrException( "Error while getting all human labeled documents for crisisID = " + crisisID + ", user name = " + userName + " from Tagger", e); } }
Example #19
Source File: TaggerServiceImpl.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@Override public Long getImageCountForCollection(String collectionCode) { Client client = ClientBuilder.newBuilder() .register(JacksonFeature.class).build(); Long count = null; try { // Rest call to Tagger WebTarget webResource = client.target(crowdsourcingAPIMainUrl + "/" + collectionCode + "/image/count"); ObjectMapper objectMapper = JacksonWrapper.getObjectMapper(); objectMapper.configure( DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); Response clientResponse = webResource.request( MediaType.APPLICATION_JSON).get(); String jsonResponse = clientResponse.readEntity(String.class); count = objectMapper.readValue( jsonResponse, Long.class); } catch (Exception e) { logger.error("Error while getting image count for collection = " + collectionCode, e); } return count; }
Example #20
Source File: TaggerServiceImpl.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@Override public Long getTaggedImageCount(Integer crisisID) { Client client = ClientBuilder.newBuilder() .register(JacksonFeature.class).build(); Long count = 0L; try { // Rest call to Tagger WebTarget webResource = client.target(crowdsourcingAPIMainUrl + "/taggedImage/getCount/" + crisisID); ObjectMapper objectMapper = JacksonWrapper.getObjectMapper(); objectMapper.configure( DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); Response clientResponse = webResource.request( MediaType.APPLICATION_JSON).get(); String jsonResponse = clientResponse.readEntity(String.class); count = objectMapper.readValue( jsonResponse, Long.class); } catch (Exception e) { logger.error("Error while getting image count for collection = " + crisisID, e); } return count; }
Example #21
Source File: TaskManagerEntityMapper.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@Deprecated public <E> E deSerializeList(String jsonString, TypeReference<E> type) { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); try { if (jsonString != null) { E docList = mapper.readValue(jsonString, type); return docList; } } catch (Exception e) { logger.error("JSON deserialization exception",e); } return null; }
Example #22
Source File: TaskManagerEntityMapper.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@Deprecated public <E> String serializeTask(E task) { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); String jsonString = null; try { if (task != null) jsonString = mapper.writeValueAsString(task); } catch (IOException e) { logger.error("JSON serialization exception",e); } return jsonString; }
Example #23
Source File: TaggerServiceImpl.java From AIDR with GNU Affero General Public License v3.0 | 5 votes |
@Override public TaggerResponseWrapper getHumanLabeledDocumentsByCrisisID( Long crisisID, Integer count) throws AidrException { Client client = ClientBuilder.newBuilder() .register(JacksonFeature.class).build(); try { // Rest call to Tagger WebTarget webResource = client.target(taggerMainUrl + "/misc/humanLabeled/crisisID/" + crisisID + "?count=" + count); ObjectMapper objectMapper = JacksonWrapper.getObjectMapper(); objectMapper.configure( DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); Response clientResponse = webResource.request( MediaType.APPLICATION_JSON).get(); String jsonResponse = clientResponse.readEntity(String.class); TaggerResponseWrapper dtoList = objectMapper.readValue( jsonResponse, TaggerResponseWrapper.class); logger.info("Number of human labeled documents returned by Tagger: " + (dtoList.getHumanLabeledItems() != null ? dtoList .getHumanLabeledItems().size() : 0)); return dtoList; } catch (Exception e) { logger.error("Error while getting all human labeled documents for crisisID = " + crisisID + " from Tagger", e); throw new AidrException( "Error while getting all human labeled documents for crisisID = " + crisisID + " from Tagger", e); } }
Example #24
Source File: QueryExecutorServlet.java From incubator-tajo with Apache License 2.0 | 5 votes |
@Override public void init(ServletConfig config) throws ServletException { om.getDeserializationConfig().disable( DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES); try { tajoClient = new TajoClient(new TajoConf()); queryRunnerCleaner = new QueryRunnerCleaner(); queryRunnerCleaner.start(); } catch (IOException e) { LOG.error(e.getMessage()); } }
Example #25
Source File: AtlasAPIV2ServerEmulator.java From nifi with Apache License 2.0 | 5 votes |
private static <T> T readInputJSON(HttpServletRequest req, Class<? extends T> clazz) throws IOException { return new ObjectMapper() .configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false) .reader() .withType(clazz) .readValue(req.getInputStream()); }
Example #26
Source File: JsonObjectMapperParser.java From RDFS with Apache License 2.0 | 5 votes |
/** * Constructor. * * @param input * The input stream for the JSON data. */ public JsonObjectMapperParser(InputStream input, Class<? extends T> clazz) throws IOException { mapper = new ObjectMapper(); mapper.configure( DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true); this.clazz = clazz; decompressor = null; jsonParser = mapper.getJsonFactory().createJsonParser(input); }
Example #27
Source File: RegistryChangeService.java From occurrence with Apache License 2.0 | 5 votes |
/** * We have to create our own object mapper in order to set FAIL_ON_UNKNOWN, without which we can't deser reg objects */ private ObjectMapper createObjectMapper() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); Mixins.getPredefinedMixins().forEach((key, value) -> { objectMapper.getSerializationConfig().addMixInAnnotations(key, value); objectMapper.getDeserializationConfig().addMixInAnnotations(key, value); }); return objectMapper; }
Example #28
Source File: DefaultIndexMapper.java From Raigad with Apache License 2.0 | 5 votes |
public DefaultIndexMapper(JsonFactory factory) { super(factory); SimpleModule serializerModule = new SimpleModule("default serializers", new Version(1, 0, 0, null)); registerModule(serializerModule); configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); configure(SerializationConfig.Feature.AUTO_DETECT_GETTERS, false); configure(SerializationConfig.Feature.AUTO_DETECT_FIELDS, false); configure(SerializationConfig.Feature.INDENT_OUTPUT, false); }
Example #29
Source File: DefaultMasterNodeInfoMapper.java From Raigad with Apache License 2.0 | 5 votes |
public DefaultMasterNodeInfoMapper(JsonFactory factory) { super(factory); SimpleModule serializerModule = new SimpleModule("default serializers", new Version(1, 0, 0, null)); registerModule(serializerModule); configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false); }
Example #30
Source File: StringCodec.java From Bats with Apache License 2.0 | 5 votes |
@Override public T fromString(String string) { try { ObjectMapper mapper = new ObjectMapper(); mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false); ObjectReader reader = mapper.reader(clazz); return reader.readValue(string); } catch (IOException e) { throw Throwables.propagate(e); } }