Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.SerializationConfig


  public static String ObjectToJson(Object object) throws JsonGenerationException,
      JsonMappingException,
      IOException
  {
    ObjectMapper mapper = new ObjectMapper();
    SerializationConfig serializationConfig = mapper.getSerializationConfig();
    serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, true);

    StringWriter sw = new StringWriter();
    mapper.writeValue(sw, object);

    return sw.toString();
View Full Code Here


          _zkClient.setZkSerializer(new ZNRecordSerializer());
          ZNRecord record = _zkClient.readData(fullPath);

          // dump the node content into log file
          ObjectMapper mapper = new ObjectMapper();
          SerializationConfig serializationConfig = mapper.getSerializationConfig();
          serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, true);

          StringWriter sw = new StringWriter();
          try
          {
            mapper.writeValue(sw, record);
View Full Code Here

  public static String ObjectToJson(Object object) throws JsonGenerationException,
      JsonMappingException,
      IOException
  {
    ObjectMapper mapper = new ObjectMapper();
    SerializationConfig serializationConfig = mapper.getSerializationConfig();
    serializationConfig.set(SerializationConfig.Feature.INDENT_OUTPUT, true);

    StringWriter sw = new StringWriter();
    mapper.writeValue(sw, object);

    return sw.toString();
View Full Code Here

  public ObjectMapperDecorator(BaseUrl baseUrl) {
    this.baseUrl = baseUrl;
  }

  public ObjectMapper decorate(ObjectMapper mapper) {
    SerializationConfig config = mapper.getSerializationConfig();
    VisibilityChecker<?> checker = config.getDefaultVisibilityChecker();

    mapper.setVisibilityChecker(
        checker
            .withFieldVisibility(JsonAutoDetect.Visibility.ANY)
            .withGetterVisibility(JsonAutoDetect.Visibility.NONE)
View Full Code Here

  @Override
  public String toString() {
    ObjectMapper mapper = new ObjectMapper();
    StringWriter sw = new StringWriter();
    try {
      SerializationConfig config = mapper.getSerializationConfig();
      config.setSerializationInclusion(Inclusion.NON_NULL);
      mapper.writeValue(sw, this);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return sw.toString();
View Full Code Here

  @Override
  public String toString() {
    ObjectMapper mapper = new ObjectMapper();
    StringWriter sw = new StringWriter();
    try {
      SerializationConfig config = mapper.getSerializationConfig();
      config.setSerializationInclusion(Inclusion.NON_NULL);
      mapper.writeValue(sw, this);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return sw.toString();
View Full Code Here

        return senatorKey;
    }

    public static ObjectMapper getMapper() {
        ObjectMapper mapper = new ObjectMapper();
        SerializationConfig cnfg = mapper.getSerializationConfig();
        cnfg.set(Feature.INDENT_OUTPUT, true);
        mapper.setSerializationConfig(cnfg);

        return mapper;
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.map.SerializationConfig

Copyright © 2018 www.massapicom. 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.