View Javadoc

1   package de.mxro.async.map.sql.internal;
2   
3   import de.mxro.fn.Function;
4   
5   public class EncodeCaseInsensitiveKey implements Function<String, String> {
6   
7       @Override
8       public String apply(final String input) {
9   
10          String res = "";
11          // System.out.println("INPUT " + input);
12          for (int i = 0; i < input.length(); i++) {
13              final char testChar = input.charAt(i);
14  
15              assert testChar != '^' : "Found illegal character for Case Sensitive Encoding: ^\n" + "   In Key: " + input;
16  
17              if (!Character.isUpperCase(testChar) || testChar == '_' || testChar == '/' || testChar == '-') {
18                  res += testChar;
19              } else {
20                  res += "^" + testChar;
21              }
22  
23          }
24  
25          return res;
26      }
27  
28  }