Java Code Examples for org.codehaus.jackson.ObjectCodec#readTree()
The following examples show how to use
org.codehaus.jackson.ObjectCodec#readTree() .
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: RuleJsonDeserializer.java From urule with Apache License 2.0 | 5 votes |
@Override public List<Rule> deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { ObjectCodec oc = jp.getCodec(); JsonNode jsonNode = oc.readTree(jp); Iterator<JsonNode> childrenNodesIter=jsonNode.getElements(); List<Rule> rules=new ArrayList<Rule>(); while(childrenNodesIter.hasNext()){ JsonNode childNode=childrenNodesIter.next(); rules.add(parseRule(jp,childNode)); } return rules; }
Example 2
Source File: JsonControlJvm.java From jwala with Apache License 2.0 | 5 votes |
@Override public JsonControlJvm deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { final ObjectCodec obj = jp.getCodec(); final JsonNode rootNode = obj.readTree(jp); final JsonNode operation = rootNode.get("controlOperation"); return new JsonControlJvm(operation.getTextValue()); }
Example 3
Source File: JsonUpdateGroup.java From jwala with Apache License 2.0 | 5 votes |
@Override public JsonUpdateGroup deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { final ObjectCodec obj = jp.getCodec(); final JsonNode node = obj.readTree(jp); return new JsonUpdateGroup(node.get("id").getTextValue(), node.get("name").getTextValue()); }
Example 4
Source File: JsonJvms.java From jwala with Apache License 2.0 | 5 votes |
@Override public JsonJvms deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { final ObjectCodec obj = jp.getCodec(); final JsonNode rootNode = obj.readTree(jp); final Set<String> rawJvmIds = deserializeJvmIdentifiers(rootNode); return new JsonJvms(rawJvmIds); }
Example 5
Source File: JsonControlGroup.java From jwala with Apache License 2.0 | 5 votes |
@Override public JsonControlGroup deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { final ObjectCodec obj = jp.getCodec(); final JsonNode rootNode = obj.readTree(jp); final JsonNode operation = rootNode.get("controlOperation"); return new JsonControlGroup(operation.getTextValue()); }
Example 6
Source File: JsonControlWebServer.java From jwala with Apache License 2.0 | 5 votes |
@Override public JsonControlWebServer deserialize(final JsonParser jp, final DeserializationContext ctxt) throws IOException { final ObjectCodec obj = jp.getCodec(); final JsonNode rootNode = obj.readTree(jp); final JsonNode operation = rootNode.get("controlOperation"); return new JsonControlWebServer(operation.getTextValue()); }
Example 7
Source File: ContainerPlacementMessageObjectMapper.java From samza with Apache License 2.0 | 5 votes |
@Override public ContainerPlacementMessage deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); String subType = node.get("subType").getTextValue(); String deploymentId = node.get("deploymentId").getTextValue(); String processorId = node.get("processorId").getTextValue(); String destinationHost = node.get("destinationHost").getTextValue(); long timestamp = node.get("timestamp").getLongValue(); Duration requestExpiry = node.get("requestExpiry") == null ? null : Duration.ofMillis(node.get("requestExpiry").getLongValue()); ContainerPlacementMessage.StatusCode statusCode = null; UUID uuid = UUID.fromString(node.get("uuid").getTextValue()); for (ContainerPlacementMessage.StatusCode code : ContainerPlacementMessage.StatusCode.values()) { if (code.name().equals(node.get("statusCode").getTextValue())) { statusCode = code; } } ContainerPlacementMessage message = null; if (subType.equals(ContainerPlacementRequestMessage.class.getSimpleName())) { message = new ContainerPlacementRequestMessage(uuid, deploymentId, processorId, destinationHost, requestExpiry, timestamp); } else if (subType.equals(ContainerPlacementResponseMessage.class.getSimpleName())) { String responseMessage = node.get("responseMessage").getTextValue(); message = new ContainerPlacementResponseMessage(uuid, deploymentId, processorId, destinationHost, requestExpiry, statusCode, responseMessage, timestamp); } return message; }
Example 8
Source File: SamzaObjectMapper.java From samza with Apache License 2.0 | 5 votes |
@Override public Config deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); return new MapConfig(OBJECT_MAPPER.<Map<String, String>>readValue(node, new TypeReference<Map<String, String>>() { })); }
Example 9
Source File: SamzaObjectMapper.java From samza with Apache License 2.0 | 5 votes |
@Override public TaskMode deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); if (node == null || node.getTextValue().equals("")) { return TaskMode.Active; } else { return TaskMode.valueOf(node.getTextValue()); } }
Example 10
Source File: SamzaObjectMapper.java From samza with Apache License 2.0 | 5 votes |
@Override public SystemStreamPartition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); String system = node.get("system").getTextValue(); String stream = node.get("stream").getTextValue(); Partition partition = new Partition(node.get("partition").getIntValue()); return new SystemStreamPartition(system, stream, partition); }
Example 11
Source File: CustomFieldDeSerializer.java From jira-rest-client with Apache License 2.0 | 5 votes |
@Override public Object deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { logger.info("Deserialize..."); ObjectCodec oc = jp.getCodec(); JsonNode node = oc.readTree(jp); for (int i = 0; i < node.size(); i++) { JsonNode child = node.get(i); if (child == null) { logger.info(i + "th Child node is null"); continue; } //String if (child.isTextual()) { Iterator<String> it = child.getFieldNames(); while (it.hasNext()) { String field = it.next(); logger.info("in while loop " + field); if (field.startsWith("customfield")) { } } } } return null; }
Example 12
Source File: SamzaObjectMapper.java From samza with Apache License 2.0 | 4 votes |
@Override public Partition deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); return new Partition(node.getIntValue()); }
Example 13
Source File: SamzaObjectMapper.java From samza with Apache License 2.0 | 4 votes |
@Override public TaskName deserialize(JsonParser jsonParser, DeserializationContext context) throws IOException, JsonProcessingException { ObjectCodec oc = jsonParser.getCodec(); JsonNode node = oc.readTree(jsonParser); return new TaskName(node.getTextValue()); }