Пример #1
0
 public static Map<String, String> parseRef(String ref) throws MalformedURLException {
   Pattern pattern = getRegex();
   Matcher matcher = pattern.matcher(ref);
   DBP.printdebugln(matcher);
   Map<String, String> queries = new HashMap<>();
   try {
     while (matcher.find()) {
       DBP.printdebugln(matcher.group(3));
       String field = matcher.group("field");
       if (matcher.group(3).isEmpty()) {
         queries.put("id", field);
       } else {
         String value = matcher.group("value");
         queries.put(field, value);
       }
     }
   } catch (IllegalArgumentException e) {
     DBP.printException(e);
     throw new MalformedURLException();
   }
   return queries;
 }
Пример #2
0
  public static Map<String, String> parseQueries(String query) throws MalformedURLException {
    Map<String, String> queries = new HashMap<>();

    Pattern pattern = getRegex();
    Matcher matcher = pattern.matcher(query);

    try {
      while (matcher.find()) {
        String field = matcher.group("field");
        String value = matcher.group("value");
        queries.put(field, value);
      }
    } catch (IllegalArgumentException e) {
      DBP.printException(e);
      throw new MalformedURLException();
    }
    return queries;
  }