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.hurence.logisland.config.ConfigReader.java

/**
 * Loads a YAML config file/*from  w  ww . j  a  va2 s.co m*/
 *
 * @param configFilePath the path of the config file
 * @return a LogislandSessionConfiguration
 * @throws Exception
 */
public static LogislandConfiguration loadConfig(String configFilePath) throws Exception {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    File configFile = new File(configFilePath);

    if (!configFile.exists()) {
        throw new FileNotFoundException("Error: File " + configFilePath + " not found!");
    }

    return mapper.readValue(configFile, LogislandConfiguration.class);
}

From source file:com.chiralbehaviors.scout.server.ScoutConfiguration.java

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

From source file:com.chiral.oauth.OAuthConfiguration.java

public static OAuthConfiguration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    OAuthConfiguration configuration = new ObjectMapper(new YAMLFactory()).readValue(yaml,
            OAuthConfiguration.class);
    yaml.close();//from  w ww  .ja v  a 2s.c  o  m
    return configuration;
}

From source file:de.stadtrallye.rallyesoft.util.converters.Serialization.java

public static ObjectMapper getSmileInstance() {
    if (smileMapper == null) {
        smileMapper = new ObjectMapper(new SmileFactory());
    }/*from w w w. j  av  a2  s  .  c om*/
    return smileMapper;
}

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

public static ObjectMapper getStatelessMapper() {
    if (statelessMapper == null) {
        statelessMapper = new ObjectMapper(new YAMLFactory());
        statelessMapper.addMixInAnnotations(ObjectMeta.class, ObjectMetaMixIn.class);
        statelessMapper.addMixInAnnotations(ReplicationController.class, ReplicationControllerMixIn.class);
    }/*  w  w  w  .j  ava  2  s  . c o  m*/
    return statelessMapper;
}

From source file:com.chiralbehaviors.CoRE.loader.Configuration.java

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

From source file:com.hellblazer.gossip.configuration.YamlHelper.java

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

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

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

From source file:com.chiralBehaviors.groo.configuration.GrooConfiguration.java

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

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

public static Configuration fromYaml(InputStream yaml)
        throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
    mapper.registerModule(getModule());/*from   www. ja v  a 2  s  . com*/
    return mapper.readValue(yaml, Configuration.class);
}