Skip to content

Commit

Permalink
improve convert script
Browse files Browse the repository at this point in the history
  • Loading branch information
nikos committed Mar 26, 2015
1 parent 19e903c commit 351b5a7
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions utils/src/main/groovy/ConvertXML2Json.groovy
Expand Up @@ -99,12 +99,26 @@ Property createProperty (attribute) {
case "LAYOUT_WEIGHT":
type = "float";
break;
case "SCALETYPE":
value = splitCamelCase(value).replaceAll(" ", "_");
break;
}

return new Property( name, type, value );

}

String splitCamelCase(String s) {
return s.replaceAll(
String.format("%s|%s|%s",
"(?<=[A-Z])(?=[A-Z][a-z])",
"(?<=[^A-Z])(?=[A-Z])",
"(?<=[A-Za-z])(?=[^A-Za-z])"
),
" "
);
}

@groovy.transform.Canonical
@groovy.transform.ToString(excludes='views')
class View {
Expand Down

0 comments on commit 351b5a7

Please sign in to comment.