@Test public void testWithInt() throws Exception { Vertex vertex = function.map("{\"someInt\": -123, \"withExponent\": 3.1e+2}"); expectedValue.setProperty("someInt", "-123"); expectedValue.setProperty("withExponent", "310.0"); assertVertexEquals(expectedValue, vertex); }
@Override public EPGMVertex map(String jsonString) throws Exception { JSONObject jsonVertex = new JSONObject(jsonString); Properties properties = reuse.getProperties(); if (properties == null) { properties = Properties.create(); reuse.setProperties(properties); } properties.clear(); for (Iterator it = jsonVertex.keys(); it.hasNext();) { String key = (String) it.next(); PropertyValue propertyValue = getPropertyValue(jsonVertex, key); properties.set(key, propertyValue); } return reuse; }
MinimalJsonToVertex implements MapFunction<String, EPGMVertex> { @Override public EPGMVertex map(String jsonString) throws Exception { JSONObject jsonVertex = new JSONObject(jsonString); Properties properties = reuse.getProperties(); if (properties == null) { properties = Properties.create(); reuse.setProperties(properties); } properties.clear(); for (Iterator it = jsonVertex.keys(); it.hasNext();) { String key = (String) it.next(); PropertyValue propertyValue = getPropertyValue(jsonVertex, key); properties.set(key, propertyValue); } return reuse; } }
MinimalJsonToVertex implements MapFunction<String, EPGMVertex> { @Override public EPGMVertex map(String jsonString) throws Exception { JSONObject jsonVertex = new JSONObject(jsonString); Properties properties = reuse.getProperties(); if (properties == null) { properties = Properties.create(); reuse.setProperties(properties); } properties.clear(); for (Iterator it = jsonVertex.keys(); it.hasNext();) { String key = (String) it.next(); PropertyValue propertyValue = getPropertyValue(jsonVertex, key); properties.set(key, propertyValue); } return reuse; } MinimalJsonToVertex(VertexFactory<EPGMVertex> vertexFactory); }
MinimalJsonToVertex implements MapFunction<String, EPGMVertex> { @Override public EPGMVertex map(String jsonString) throws Exception { JSONObject jsonVertex = new JSONObject(jsonString); Properties properties = reuse.getProperties(); if (properties == null) { properties = Properties.create(); reuse.setProperties(properties); } properties.clear(); for (Iterator it = jsonVertex.keys(); it.hasNext();) { String key = (String) it.next(); PropertyValue propertyValue = getPropertyValue(jsonVertex, key); properties.set(key, propertyValue); } return reuse; } MinimalJsonToVertex(VertexFactory<EPGMVertex> vertexFactory); @Override EPGMVertex map(String jsonString); }
MinimalJsonToVertex implements MapFunction<String, EPGMVertex> { @Override public EPGMVertex map(String jsonString) throws Exception { JSONObject jsonVertex = new JSONObject(jsonString); Properties properties = reuse.getProperties(); if (properties == null) { properties = Properties.create(); reuse.setProperties(properties); } properties.clear(); for (Iterator it = jsonVertex.keys(); it.hasNext();) { String key = (String) it.next(); PropertyValue propertyValue = getPropertyValue(jsonVertex, key); properties.set(key, propertyValue); } return reuse; } MinimalJsonToVertex(VertexFactory<EPGMVertex> vertexFactory); @Override EPGMVertex map(String jsonString); static final String JSON_VERTEX_LABEL; }