Examples of ObjectMapper


Examples of com.dotcms.repackage.org.codehaus.jackson.map.ObjectMapper

  public ESMappingAPIImpl() {
    if (mapper == null) {
      synchronized (this.getClass().getName()) {
        if (mapper == null) {
          mapper = new ObjectMapper();
          ThreadSafeSimpleDateFormat df = new ThreadSafeSimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
          mapper.setDateFormat(df);
        }
      }
    }
View Full Code Here

Examples of com.facebook.presto.hive.shaded.org.codehaus.jackson.map.ObjectMapper

            }
        }
        objectNode.put("type", schemaType);
        if (objectProperties != null) {
            try {
                objectNode.put("properties", new ObjectMapper().readValue(objectProperties, JsonNode.class));
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }
        }
        if (itemDefinition != null) {
            try {
                objectNode.put("items", new ObjectMapper().readValue(itemDefinition, JsonNode.class));
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }
        }
        // always optional, no need to specify:
View Full Code Here

Examples of com.facebook.presto.jdbc.internal.jackson.databind.ObjectMapper

        return new JsonCodec<>(createObjectMapper(), mapType);
    }

    private ObjectMapper createObjectMapper()
    {
        ObjectMapper objectMapper = null;

        // Work around for http://code.google.com/p/google-guice/issues/detail?id=627
        RuntimeException lastException = null;
        for (int i = 0; objectMapper == null && i < 10; i++) {
            try {
                objectMapper = objectMapperProvider.get();
            }
            catch (RuntimeException e) {
                lastException = e;
            }
        }
        if (objectMapper == null) {
            throw lastException;
        }

        if (prettyPrint) {
            objectMapper.enable(INDENT_OUTPUT);
        }
        else {
            objectMapper.disable(INDENT_OUTPUT);
        }
        return objectMapper;
    }
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper

* Configures the Jackson ObjectMapper to materialize interfaces
*/
public class MaterializedBeanObjectMapperFactory implements FactoryBean<ObjectMapper> {
    @Override
    public ObjectMapper getObject() throws Exception {
        ObjectMapper mapper = new ObjectMapper();
        mapper.registerModule(new MrBeanModule());
        return mapper;
    }
View Full Code Here

Examples of com.fasterxml.jackson.databind.ObjectMapper

            throw new RuntimeException(e);
        }
    }

    private static ObjectMapper getMapper() {
        ObjectMapper jacksonMapper = new ObjectMapper();
        AnnotationIntrospector primary = new JacksonAnnotationIntrospector();
        jacksonMapper.setAnnotationIntrospector(primary);
        jacksonMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
        jacksonMapper.registerModule(new MrBeanModule());
        return jacksonMapper;
    }
View Full Code Here

Examples of com.google.appengine.repackaged.org.codehaus.jackson.map.ObjectMapper

        new LibUtils().addLibrary(war, "com.google.appengine:appengine-endpoints");
        return war;
    }

    protected void assertResponse(Map<String, String> expected, String actual) throws Exception {
        ObjectMapper mapper = new ObjectMapper();
        JsonNode root = mapper.readTree(actual);
        for (Map.Entry<String, String> entry : expected.entrySet()) {
            Assert.assertEquals(entry.getValue(), root.get(entry.getKey()).asText());
        }
    }
View Full Code Here

Examples of com.pardot.rhombus.ObjectMapper

        //Rebuild the keyspace and get the object mapper
        cm.buildKeyspace(keyspaceDefinition, true);
        logger.debug("Built keyspace: {}", keyspaceDefinition.getName());
        cm.setDefaultKeyspace(keyspaceDefinition);
        ObjectMapper om = cm.getObjectMapper();
        om.setLogCql(true);
        om.truncateTables();

        // This is the only static table definition this test keyspace has
        List<String> staticTableNames = Arrays.asList(testUniqueTableName);

        //Insert our test data into the SSTable
        // For this test, all this data goes into the one table we have defined
        List<Map<String, Object>> values = JsonUtil.rhombusMapFromResource(this.getClass().getClassLoader(), "SSTableWriterSimpleTestData.js");
        // Tack on time based UUIDs because we don't really care what the UUID values are
        for (Map<String, Object> map : values) {
            map.put("id", UUIDs.startOf(Long.parseLong(map.get("created_at").toString(), 10)));
        }
        // Build the map to insert that we'll actually pass in
        Map<String, List<Map<String, Object>>> insert = new HashMap<String, List<Map<String, Object>>>();
        for (String staticTableName : staticTableNames) {
            insert.put(staticTableName, values);
        }

        // Actually insert the data into the SSTableWriters
        om.initializeSSTableWriters(false);
        om.insertIntoSSTable(insert);
        om.completeSSTableWrites();

        // Figure out all the table names (including index tables) so we can load them into Cassandra
        File[] tableDirs = keyspaceDir.listFiles();
        assertNotNull(tableDirs);
        List<String> allTableNames = Lists.newArrayList();
        for (File file : tableDirs) {
            if (file != null) {
                allTableNames.add(file.getName());
            }
        }
        for (String tableName : allTableNames) {
            String SSTablePath = keyspaceName + "/" + tableName;

            // Load the SSTables into Cassandra
            ProcessBuilder builder = new ProcessBuilder("sstableloader", "-d", "localhost", SSTablePath);
            builder.redirectErrorStream(true);
            Process p = builder.start();
            BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
            long startTime = System.currentTimeMillis();
            // TODO: sleep is the devil
            while (!r.readLine().contains("100%") && ((System.currentTimeMillis() - startTime) < 10000)) {
                Thread.sleep(100);
            }
        }

        String staticTableName = staticTableNames.get(0);
        for (Map<String, Object> expected : values) {
            Map<String, Object> actual = om.getByKey(staticTableName, expected.get("id"));
            assertEquals(expected, actual);
        }

        Map<String, Map<String, Object>> indexedExpected = Maps.uniqueIndex(values, new Function<Map<String, Object>,String>() {
            public String apply(Map<String, Object> input) {
                return input.get("id").toString();
            }});
        // Confirm get by index_1 query
        SortedMap<String, Object> indexValues = Maps.newTreeMap();
        indexValues.put("index_1", "index1");
        Criteria criteria = new Criteria();
        criteria.setIndexKeys(indexValues);
        criteria.setLimit(50L);
        List<Map<String, Object>> results = om.list(testUniqueTableName, criteria);
        Map<String, Map<String, Object>> indexedResults;
        indexedResults = Maps.uniqueIndex(results, new Function<Map<String, Object>, String>() {
            public String apply(Map<String, Object> input) {
                return input.get("id").toString();
            }
        });
        Map<String, Map<String, Object>> indexedExpected1 = Maps.newHashMap(indexedExpected);
        // Index_1 test data doesn't include value 4
        indexedExpected1.remove("864f1400-2a7e-11b2-8080-808080808080");
        assertEquals(indexedExpected1, indexedResults);

        // Confirm get by index_2 query
        indexValues = Maps.newTreeMap();
        indexValues.put("index_2", "index2");
        criteria = new Criteria();
        criteria.setIndexKeys(indexValues);
        criteria.setLimit(50L);
        results = om.list(testUniqueTableName, criteria);

        indexedResults = Maps.uniqueIndex(results, new Function<Map<String, Object>,String>() {
            public String apply(Map<String, Object> input) {
                return input.get("id").toString();
            }});
View Full Code Here

Examples of com.sdicons.json.mapper.helper.impl.ObjectMapper

  throw new MapperException("AjPropertyValue cannot map: " + aValue.getClass().getName());
    }

    @Override
    public JSONValue toJSON(Object aPojo) throws MapperException {
  ObjectMapper objectMapper = new ObjectMapper();
  return objectMapper.toJSON(aPojo);
    }
View Full Code Here

Examples of org.boon.json.ObjectMapper

            if (query != null) {
                List<Object> res = new ArrayList<Object>();
                while (query.hasNext()) {
                    res.add(query.next());
                }
                ObjectMapper mapper = new ObjectMapperImpl();
                result = mapper.toJson(res);
            }
            return new Result("boon", time, result, error);
        }
    }
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper

    if (objectMapper == null && applicationContext != null) {
      try {
        objectMapper = (ObjectMapper)BeanFactoryUtils
          .beanOfTypeIncludingAncestors(applicationContext, ObjectMapper.class);
      } catch (Exception e) {
        objectMapper = new ObjectMapper();
      }
    }

    // create JsonRpcHttpClient
    try {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.