private List<QoSRule> createQoSRules(JsonObject qosSettings){
  List<QoSRule> rules=new ArrayList<>();
  if (qosSettings.containsKey(JSON_FIELD_RULES)) {
    JsonObject jsonRules=qosSettings.getJsonObject(JSON_FIELD_RULES);
    for (    String urlPatternRegExp : jsonRules.fieldNames()) {
      log.debug("Creating a new QoS rule object for URL pattern: " + urlPatternRegExp);
      JsonObject jsonRule=jsonRules.getJsonObject(urlPatternRegExp);
      Pattern urlPattern=Pattern.compile(urlPatternRegExp);
      QoSRule rule=new QoSRule(urlPattern);
      boolean addRule=false;
      if (jsonRule.containsKey("reject")) {
        addRule=true;
        rule.setReject(jsonRule.getDouble("reject"));
      }
      if (jsonRule.containsKey("warn")) {
        addRule=true;
        rule.setWarn(jsonRule.getDouble("warn"));
      }
      if (addRule) {
        rules.add(rule);
      }
 else {
        log.warn("No or unknown QoS action defined for rule {}. This rule will not be loaded!",urlPatternRegExp);
      }
    }
  }
  return rules;
}

private List < QoSRule > createQoSRules ( JsonObject qosSettings ) { List < QoSRule > rules = new ArrayList < > ( ) ; if ( qosSettings . containsKey ( JSON_FIELD_RULES ) ) { JsonObject jsonRules = qosSettings . getJsonObject ( JSON_FIELD_RULES ) ; for ( String urlPatternRegExp : jsonRules . fieldNames ( ) ) { log . debug ( "Creating a new QoS rule object for URL pattern: " + urlPatternRegExp ) ; JsonObject jsonRule = jsonRules . getJsonObject ( urlPatternRegExp ) ; Pattern urlPattern = Pattern . compile ( urlPatternRegExp ) ; QoSRule rule = new QoSRule ( urlPattern ) ; boolean addRule = false ; if ( jsonRule . containsKey ( "reject" ) ) { addRule = true ; rule . setReject ( jsonRule . getDouble ( "reject" ) ) ; } if ( jsonRule . containsKey ( "warn" ) ) { addRule = true ; rule . setWarn ( jsonRule . getDouble ( "warn" ) ) ; } if ( addRule ) { rules . add ( rule ) ; } else { log . warn ( "No or unknown QoS action defined for rule {}. This rule will not be loaded!" , urlPatternRegExp ) ; } } } return rules ; }
creates the qos rule objects from the given jsonobject and returns them in a list .
