List of usage examples for com.fasterxml.jackson.databind JsonNode textValue
public String textValue()
From source file:com.github.fge.jsonschema.processors.validation.ArraySchemaSelectorTest.java
@DataProvider public Iterator<Object[]> testData() throws ProcessingException, JsonPointerException { final List<Object[]> list = Lists.newArrayList(); JsonNode digest;//from w w w . j av a2 s. c o m int elementIndex; List<JsonPointer> ret; for (final JsonNode node : testNode) { digest = node.get("digest"); elementIndex = node.get("elementIndex").intValue(); ret = Lists.newArrayList(); for (final JsonNode element : node.get("ret")) ret.add(new JsonPointer(element.textValue())); list.add(new Object[] { digest, elementIndex, ret }); } return list.iterator(); }
From source file:com.github.fge.jsonschema.processors.validation.ObjectSchemaSelectorTest.java
@DataProvider public Iterator<Object[]> testData() throws ProcessingException, JsonPointerException { final List<Object[]> list = Lists.newArrayList(); JsonNode digest;// w w w .j a va 2 s.c om String memberName; List<JsonPointer> ret; for (final JsonNode node : testNode) { digest = node.get("digest"); memberName = node.get("memberName").textValue(); ret = Lists.newArrayList(); for (final JsonNode element : node.get("ret")) ret.add(new JsonPointer(element.textValue())); list.add(new Object[] { digest, memberName, ret }); } return list.iterator(); }
From source file:com.rusticisoftware.tincan.InteractionComponent.java
public InteractionComponent(JsonNode jsonNode) { this();//from w w w .j a va 2s .com JsonNode idNode = jsonNode.path("id"); if (!idNode.isMissingNode()) { this.setId(idNode.textValue()); } JsonNode descriptionNode = jsonNode.path("description"); if (!descriptionNode.isMissingNode()) { this.setDescription(new LanguageMap(descriptionNode)); } }
From source file:com.evrythng.java.wrapper.mapping.TypeMapDeserializer.java
@Override public T deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { ObjectCodec codec = jp.getCodec();// w ww. j a v a 2 s . com ObjectMapper mapper = (ObjectMapper) codec; ObjectNode root = mapper.readTree(jp); JsonNode type = root.get(typeFieldName); final String sType = type == null ? null : type.textValue(); Class<? extends T> clazz = resolveClass(sType); return codec.treeToValue(root, clazz); }
From source file:com.github.reinert.jjschema.v1.SchemaWrapper.java
protected String getNodeTextValue(JsonNode node) { return node == null ? null : node.textValue(); }
From source file:org.activiti.rest.service.api.legacy.management.JobsExecuteResource.java
@Post public ObjectNode startProcessInstance(Representation entity) { try {//w w w . j a v a 2 s. c om if (authenticate(SecuredResource.ADMIN) == false) return null; String startParams = entity.getText(); JsonNode startJSON = new ObjectMapper().readTree(startParams); ArrayNode jobIdsJSON = (ArrayNode) startJSON.get("jobIds"); for (JsonNode jobId : jobIdsJSON) { ActivitiUtil.getManagementService().executeJob(jobId.textValue()); } ObjectNode successNode = new ObjectMapper().createObjectNode(); successNode.put("success", true); return successNode; } catch (Exception e) { if (e instanceof ActivitiException) { throw (ActivitiException) e; } else { throw new ActivitiException("Failed to execute jobs", e); } } }
From source file:io.syndesis.model.integration.StepDeserializer.java
@Override public Step deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException { ObjectNode node = jp.readValueAsTree(); JsonNode stepKind = node.get(STEP_KIND); if (stepKind != null) { String value = stepKind.textValue(); Class<? extends Step> resourceType = getTypeForName(value); if (resourceType == null) { throw ctxt.mappingException("No step type found for kind:" + value); } else {//from w ww . j a v a 2 s . co m return jp.getCodec().treeToValue(node, resourceType); } } return null; }
From source file:com.rusticisoftware.tincan.StatementRef.java
public StatementRef(JsonNode jsonNode) throws URISyntaxException { this();/*from ww w. jav a 2s .c o m*/ JsonNode idNode = jsonNode.path("id"); if (!idNode.isMissingNode()) { this.setId(UUID.fromString(idNode.textValue())); } }
From source file:com.wealdtech.jackson.modules.DateTimeZoneDeserializer.java
@Override public DateTimeZone deserialize(final JsonParser jsonParser, final DeserializationContext deserializationContext) throws IOException { final ObjectCodec oc = jsonParser.getCodec(); final JsonNode node = oc.readTree(jsonParser); DateTimeZone result;//from w ww .ja v a2 s.co m try { result = DateTimeZone.forID(node.textValue()); } catch (IllegalArgumentException iae) { LOGGER.warn("Attempt to deserialize invalid datetimezone {}", node.textValue()); throw new IOException("Invalid datetimezone value \"" + node.textValue() + "\"", iae); } return result; }
From source file:com.github.fge.jsonschema.walk.collectors.AbstractPointerCollectorTest.java
@DataProvider public final Iterator<Object[]> getTestData() throws JsonPointerException { final List<Object[]> list = Lists.newArrayList(); JsonNode schema;//from w w w . j a va2s . co m List<JsonPointer> pointers; for (final JsonNode element : testData) { schema = element.get("schema"); pointers = Lists.newArrayList(); for (final JsonNode node : element.get("pointers")) pointers.add(new JsonPointer(node.textValue())); list.add(new Object[] { schema, pointers }); } return list.iterator(); }