List of usage examples for com.fasterxml.jackson.databind.node JsonNodeFactory instance
JsonNodeFactory instance
To view the source code for com.fasterxml.jackson.databind.node JsonNodeFactory instance.
Click Source Link
From source file:com.hengyi.japp.print.server.rest.JappExceptionMapper.java
@Override public Response toResponse(Throwable exception) { log.debug("", exception); ArrayNode arrayErrors = JsonNodeFactory.instance.arrayNode(); getError(arrayErrors, exception);/*from w ww . j ava2 s . c o m*/ return Response.status(Status.FORBIDDEN).entity(arrayErrors).build(); }
From source file:org.apache.solr.kelvin.QueryPerformerLoader.java
@Override protected void addDefaults() { if (resources.size() == 0) { URLQueryPerformer qp = new URLQueryPerformer(); try {//w w w .j a v a2s .co m qp.configure(JsonNodeFactory.instance.objectNode()); resources.add(qp); } catch (Exception e) { e.printStackTrace(); } } }
From source file:com.nebhale.jsonpath.internal.component.WildcardPathComponentTest.java
@Test public void selectWildcardArray() { JsonNode nodeBook = NODE.get("store").get("book"); ArrayNode expected = JsonNodeFactory.instance.arrayNode(); expected.add(nodeBook.get(0));/*from w ww . j a v a 2s .c o m*/ expected.add(nodeBook.get(1)); expected.add(nodeBook.get(2)); expected.add(nodeBook.get(3)); JsonNode result = new WildcardPathComponent(null).select(nodeBook); assertEquals(expected, result); }
From source file:org.apache.solr.kelvin.responseanalyzers.LegacyResponseAnalyzerTest.java
public static Map<String, Object> quickParseForTest(String resourceName) throws Exception { LegacyResponseAnalyzer ra = new LegacyResponseAnalyzer(); JsonNode emptyConf = JsonNodeFactory.instance.objectNode(); ra.configure(emptyConf); //empty conf XmlResponseAnalyzer ra_xml = new XmlResponseAnalyzer(); ra_xml.configure(emptyConf);//from w ww . j av a 2 s . c o m Map<String, Object> previousResponses = new HashMap<String, Object>(); previousResponses.put(QueryPerformer.RAW_RESPONSE, IOUtils.toString(XmlResponseAnalyzerTest.class.getResourceAsStream(resourceName), "utf8")); try { ra_xml.decode(previousResponses); } catch (Exception e) { //its ok to skip, the class must works also in case of errors } ra.decode(previousResponses); return previousResponses; }
From source file:org.apache.solr.kelvin.responseanalyzers.LegacyResponseAnalyzerTest.java
@Override protected void setUp() throws Exception { super.setUp(); ra = new LegacyResponseAnalyzer(); JsonNode emptyConf = JsonNodeFactory.instance.objectNode(); ra.configure(emptyConf); //empty conf ra_xml = new XmlResponseAnalyzer(); ra_xml.configure(emptyConf);//from w w w . j a va 2s.c om }
From source file:com.meltmedia.dropwizard.crypto.JsonPointerEditorTest.java
@Before public void setUp() { mapper = new ObjectMapper(); factory = JsonNodeFactory.instance; }
From source file:es.bsc.amon.util.tree.TreeNodeFactory.java
public static JsonNode toJson(TreeNode n) { JsonNode json = null;/* w w w .jav a 2 s .c o m*/ if (n instanceof ObjNode) { json = new ObjectNode(JsonNodeFactory.instance); for (Map.Entry<String, TreeNode> e : ((ObjNode) n).properties.entrySet()) { ((ObjectNode) json).put(e.getKey(), toJson(e.getValue())); } } else if (n instanceof NodeArray) { json = new ArrayNode(JsonNodeFactory.instance); for (TreeNode ne : ((NodeArray) n).elements) { ((ArrayNode) json).add(toJson(ne)); } } else if (n instanceof StringValue) { json = new TextNode(((StringValue) n).value); } else if (n instanceof NumberValue) { Number val = ((NumberValue) n).value; if (val instanceof Byte || val instanceof Short || val instanceof Integer || val instanceof Long) { json = new LongNode(val.longValue()); } else { json = new DoubleNode(val.doubleValue()); } } else throw new RuntimeException("You should not reach this"); return json; }
From source file:com.vaporwarecorp.mirror.feature.houndify.AbstractHoundifyCommand.java
public AbstractHoundifyCommand(String intent, String expression, String response) { mNodeFactory = JsonNodeFactory.instance; mClientMatch = new ClientMatch(); mClientMatch.setExpression(expression); mClientMatch.setAllResponses(response); mClientMatch.setResult(mNodeFactory.objectNode().put("Intent", intent)); }
From source file:org.apache.solr.kelvin.responseanalyzers.XmlDoclistExtractorResponseAnalyzerTest.java
@Override protected void setUp() throws Exception { super.setUp(); ra = new XmlDoclistExtractorResponseAnalyzer(); JsonNode emptyConf = JsonNodeFactory.instance.objectNode(); ra.configure(emptyConf); //empty conf ra_xml = new XmlResponseAnalyzer(); ra_xml.configure(emptyConf);//w ww . ja v a 2 s .co m }
From source file:com.ikanow.aleph2.search_service.elasticsearch.utils.JsonNodeWritableUtils.java
/** Creates a lazy object node from a MapWritable * @param m// w w w .j a v a2 s. co m * @return */ public static ObjectNode from(final MapWritable m) { return new ObjectNodeWrapper(JsonNodeFactory.instance, m); }