Ejemplo n.º 1
0
  private void parsePackageName(TypeElement layoutElement) {
    final String[] packageComponents = layoutElement.getQualifiedName().toString().split("\\.");

    final StringBuilder packageBuilder = new StringBuilder();

    for (int n = 0; n < packageComponents.length; n++) {
      if (Character.isUpperCase(packageComponents[n].charAt(0))) {
        break;
      }

      if (n > 0) {
        packageBuilder.append('.');
      }

      packageBuilder.append(packageComponents[n]);
    }

    packageName = packageBuilder.toString();
  }
Ejemplo n.º 2
0
 String stringLiteral(String value) {
   StringBuilder result = new StringBuilder();
   result.append('"');
   for (int i = 0; i < value.length(); i++) {
     char c = value.charAt(i);
     switch (c) {
       case '"':
         result.append("\\\"");
         break;
       case '\\':
         result.append("\\\\");
         break;
       case '\b':
         result.append("\\b");
         break;
       case '\t':
         result.append("\\t");
         break;
       case '\n':
         result.append("\\n");
         if (i + 1 < value.length()) {
           result.append("\"\n").append("  ").append("  ").append("+ \"");
         }
         break;
       case '\f':
         result.append("\\f");
         break;
       case '\r':
         result.append("\\r");
         break;
       default:
         if (Character.isISOControl(c)) {
           new Formatter(result).format("\\u%04x", (int) c);
         } else {
           result.append(c);
         }
     }
   }
   result.append('"');
   return result.toString();
 }
Ejemplo n.º 3
0
 private String titleToCamel(String name) {
   return Character.toLowerCase(name.charAt(0)) + name.substring(1);
 }