Пример #1
0
  public static String getRATJsonObjectHeader(String ratJson)
      throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper();
    RATJsonObject jsonHeader = (RATJsonObject) mapper.readValue(ratJson, RATJsonObject.class);
    String output = mapper.writeValueAsString(jsonHeader.getHeader());

    return output;
  }
Пример #2
0
  public static String getRATJsonHeaderProperty(String ratJson, String propertyName)
      throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper();
    RATJsonObject jsonHeader = (RATJsonObject) mapper.readValue(ratJson, RATJsonObject.class);
    String propertyValue = jsonHeader.getHeaderProperty(propertyName);

    return propertyValue;
  }
Пример #3
0
  public static JsonHeader deserializeJsonHeader(final String ratJson)
      throws JsonParseException, JsonMappingException, IOException {
    ObjectMapper mapper = new ObjectMapper();
    RATJsonObject ratJsonObject = (RATJsonObject) mapper.readValue(ratJson, RATJsonObject.class);

    TypeFactory typeFactory = mapper.getTypeFactory();
    MapType mapType = typeFactory.constructMapType(HashMap.class, String.class, String.class);
    HashMap<String, String> map = mapper.readValue(ratJsonObject.getHeader(), mapType);
    JsonHeader header = new JsonHeader();
    header.setHeaderProperties(map);

    return header;
  }
Пример #4
0
  public static String getHeader(RATJsonObject ratJson) throws JsonProcessingException {
    ObjectMapper mapper = new ObjectMapper();
    String settings = mapper.writeValueAsString(ratJson.getHeader());

    return settings;
  }