container/src/main/java/org/cloudera/log4j/redactor/StringRedactor.java
public static StringRedactor createFromJsonString(String json)
          throws IOException {
    StringRedactor sr = new StringRedactor();
    if ((json == null) || json.isEmpty()) {
      sr.policy = RedactionPolicy.emptyRedactionPolicy();
      return sr;
    }

    ObjectMapper mapper = new ObjectMapper();
    RedactionPolicy policy = mapper.readValue(json, RedactionPolicy.class);
    policy.postProcess();
    sr.policy = policy;
    return sr;
  }
public static StringRedactor createFromJsonString(String json)
          throws IOException {
    StringRedactor sr = new StringRedactor();
    if ((json == null) || json.isEmpty()) {
      sr.policy = RedactionPolicy.emptyRedactionPolicy();
      return sr;
    }

    ObjectMapper mapper = new ObjectMapper();
    RedactionPolicy policy = mapper.readValue(json, RedactionPolicy.class);
    policy.postProcess();
    sr.policy = policy;
    return sr;
  }
public static StringRedactor createFromJsonString ( String json ) throws IOException { StringRedactor sr = new StringRedactor ( ) ; if ( ( json == null ) || json . isEmpty ( ) ) { sr . policy = RedactionPolicy . emptyRedactionPolicy ( ) ; return sr ; } ObjectMapper mapper = new ObjectMapper ( ) ; RedactionPolicy policy = mapper . readValue ( json , RedactionPolicy . class ) ; policy . postProcess ( ) ; sr . policy = policy ; return sr ; }
Create a StringRedactor based on the JSON found in the given String.
The format is identical to that described in createFromJsonFile().
@param json String containing json formatted rules.
@return A freshly allocated StringRedactor
@throws JsonParseException, JsonMappingException, IOException
Create a StringRedactor based on the JSON found in the given String . The format is identical to that described in createFromJsonFile () .