Example usage for com.fasterxml.jackson.databind ObjectMapper ObjectMapper

List of usage examples for com.fasterxml.jackson.databind ObjectMapper ObjectMapper

Introduction

In this page you can find the example usage for com.fasterxml.jackson.databind ObjectMapper ObjectMapper.

Prototype

protected ObjectMapper(ObjectMapper src) 

Source Link

Document

Copy-constructor, mostly used to support #copy .

Usage

From source file:com.chiralBehaviors.autoconfigure.configuration.YamlHelper.java

public static Configuration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    mapper.registerModule(new GossipScopeModule());
    return mapper.readValue(yaml, Configuration.class);
}

From source file:com.fizzed.stork.launcher.ConfigurationFactory.java

static public ObjectMapper createObjectMapper() {
    // create json deserializer
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    mapper.setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
    return mapper;
}

From source file:io.coala.config.YamlUtil.java

/**
 * @return a {@link ObjectMapper} singleton for YAML file formats
 *//*from  ww w  .  j a  v  a 2 s .  co  m*/
public synchronized static ObjectMapper getYamlMapper() {
    if (mapper == null)
        mapper = new ObjectMapper(new YAMLFactory());
    return mapper;
}

From source file:io.fabric8.kubernetes.client.internal.KubeConfigUtils.java

public static Config parseConfig(File file) throws IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    return mapper.readValue(file, Config.class);
}

From source file:at.plechinger.spring.security.scribe.JsonUtil.java

public static Map<String, Object> parseMap(String input) throws IOException {
    JsonFactory factory = new JsonFactory();
    ObjectMapper mapper = new ObjectMapper(factory);
    TypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {
    };//w  ww  . j  a v a2 s  .c om
    return mapper.readValue(input, typeRef);
}

From source file:org.apache.ode.jacob.examples.helloworld.HelloWorld.java

@SuppressWarnings("unchecked")
public static void main(String args[]) throws Exception {
    // enable logging
    // BasicConfigurator.configure();
    List<Logger> loggers = Collections.<Logger>list(LogManager.getCurrentLoggers());
    loggers.add(LogManager.getRootLogger());
    for (Logger logger : loggers) {
        logger.setLevel(Level.OFF);
    }/*from  w ww .  j a  v  a2  s.  com*/

    SmileFactory sf = null;
    // // enable smile:
    // sf = new SmileFactory();
    // sf.enable(SmileGenerator.Feature.CHECK_SHARED_STRING_VALUES);
    // sf.enable(SmileGenerator.Feature.ENCODE_BINARY_AS_7BIT);

    ObjectMapper mapper = new ObjectMapper(sf);
    mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);

    mapper.registerModule(new JacobModule());

    JacobVPU vpu = new JacobVPU();
    JacksonExecutionQueueImpl queue = new JacksonExecutionQueueImpl();
    vpu.setContext(queue);

    long start = System.currentTimeMillis();
    vpu.inject(new HelloWorld());
    while (vpu.execute()) {
        queue = loadAndRestoreQueue(mapper, (JacksonExecutionQueueImpl) vpu.getContext());
        vpu.setContext(queue);
        System.out.println(vpu.isComplete() ? "<0>" : ".");
        //vpu.dumpState();
    }
    System.out.println("Runtime in ms: " + (System.currentTimeMillis() - start));
    vpu.dumpState();
}

From source file:com.chiralBehaviors.slp.hive.configuration.HiveScopeConfiguration.java

public static HiveScopeConfiguration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    mapper.registerModule(new EngineModule());
    return mapper.readValue(yaml, HiveScopeConfiguration.class);
}

From source file:io.fabric8.kubernetes.client.internal.SerializationUtils.java

public static ObjectMapper getMapper() {
    if (mapper == null) {
        mapper = new ObjectMapper(new YAMLFactory());
    }/*from w  w w.  j ava2s. c  om*/
    return mapper;
}

From source file:com.chiralBehaviors.slp.hive.configuration.MulticastConfiguration.java

public static MulticastConfiguration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    //mapper.registerModule(new EngineModule());
    return mapper.readValue(yaml, MulticastConfiguration.class);
}

From source file:com.hellblazer.slp.jmx.JmxDiscoveryConfiguration.java

public static JmxDiscoveryConfiguration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper objectMapper = new ObjectMapper(new YAMLFactory());
    objectMapper.registerModule(new DiscoveryModule());
    return objectMapper.readValue(yaml, JmxDiscoveryConfiguration.class);
}