Class JacksonUtil

java.lang.Object
cn.net.pap.common.jsonorm.util.JacksonUtil

public class JacksonUtil extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.fasterxml.jackson.databind.ObjectMapper
    createObjectMapper(List<String> fieldsToExclude)
    ObjectMapper
    static com.fasterxml.jackson.databind.JsonNode
    filterJson(com.fasterxml.jackson.databind.JsonNode jsonObj, com.fasterxml.jackson.databind.JsonNode targetStructure)
    清空不在目标结构中的字段,支持处理数组

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JacksonUtil

      public JacksonUtil()
  • Method Details

    • createObjectMapper

      public static com.fasterxml.jackson.databind.ObjectMapper createObjectMapper(List<String> fieldsToExclude)
      ObjectMapper
      Parameters:
      fieldsToExclude -
      Returns:
    • filterJson

      public static com.fasterxml.jackson.databind.JsonNode filterJson(com.fasterxml.jackson.databind.JsonNode jsonObj, com.fasterxml.jackson.databind.JsonNode targetStructure)
      清空不在目标结构中的字段,支持处理数组
      Parameters:
      jsonObj - 原始对象的JsonNode
      targetStructure - 目标结构的JsonNode
      Returns:
      过滤后的JsonNode