Example #1
0
  public Map processParamNames(Map reqParamValuesMap) {

    Map modifiedMap = new HashMap();
    Iterator iter = reqParamValuesMap.keySet().iterator();
    RequestParamValue reqParamObj = null;

    while (iter.hasNext()) {
      reqParamObj = new RequestParamValue();
      String keyName = (String) iter.next();
      if (keyName.endsWith("Set") && keyName.contains(",")) {
        // nameOfParentClassVariable
        if (keyName.endsWith("Set")) {
          reqParamObj.setTypeOfParentClassVarible("Set");
        } else {
          reqParamObj.setTypeOfParentClassVarible("NULL");
        }
        StringTokenizer strTokens = new StringTokenizer(keyName, ":");
        while (strTokens.hasMoreTokens()) {
          String token = strTokens.nextToken();
          if (token.contains(",")) {
            StringTokenizer nameTokens = new StringTokenizer(token, ",");
            if (nameTokens.countTokens() == 2) {
              reqParamObj.setNameofChildClassVarible(nameTokens.nextToken());
              // name of the parent property
              reqParamObj.setNameOfParentClassVariable(getPropertyName(nameTokens.nextToken()));
            }
          } else {
            reqParamObj.setClassOfParentClassVariable(token);
          }
        }

      } else {

        if (keyName.endsWith("Set")) {
          reqParamObj.setNameOfParentClassVariable(getPropertyName(keyName));
          reqParamObj.setTypeOfParentClassVarible("Set");
          reqParamObj.setClassOfParentClassVariable("java.lang.String");
        } else {
          // It is of type String ex: name
          reqParamObj.setNameOfParentClassVariable(keyName);
          reqParamObj.setTypeOfParentClassVarible("NULL");
        }
      }
      modifiedMap.put(reqParamObj, (String[]) reqParamValuesMap.get(keyName));
    }

    return modifiedMap;
  }