@@ -4,9 +4,7 @@ import com.fasterxml.jackson.dataformat.xml.XmlMapper
4
4
import in.oneton.snippet.util.Match
5
5
6
6
import static com.fasterxml.jackson.databind.SerializationFeature.INDENT_OUTPUT
7
- import static in.oneton.snippet.util.Util.getSnippetResources
8
- import static in.oneton.snippet.util.Util.nameToDescription
9
- import static in.oneton.snippet.util.Util.triggerName
7
+ import static in.oneton.snippet.util.Util.*
10
8
import static java.util.regex.Pattern.compile
11
9
import static java.util.stream.Collectors.toList
12
10
@@ -15,7 +13,7 @@ class Generator {
15
13
static LONG_FORM_PATTERN = compile(/ \$\s *\{\s *(\d +)\s *:\s *([^}]*)\s *}/ )
16
14
static SHORT_FORM_PATTERN = compile(/ \$\s *(\d +)/ )
17
15
18
- void generateAll () {
16
+ static void generateAll () {
19
17
String resourcesPath = ' src/main/resources'
20
18
String snippetsPath = ' ../snippets'
21
19
@@ -60,7 +58,7 @@ class Generator {
60
58
println " Regenerated flex layout template file. Saved to ${ snippetXml.absolutePath} "
61
59
}
62
60
63
- private File generateFromMetadata (GeneratorMetadata metadata ) {
61
+ private static File generateFromMetadata (GeneratorMetadata metadata ) {
64
62
List<Template > templates = new ArrayList<> ()
65
63
66
64
getSnippetResources(metadata. templateRootPath). forEach({ File snippetResource ->
@@ -98,31 +96,31 @@ class Generator {
98
96
return file
99
97
}
100
98
101
- private String replaceWithVarFormat (String text , int index ) {
99
+ private static String replaceWithVarFormat (String text , int index ) {
102
100
String modifiedText = replaceWithVarFormat(text, index, true )
103
101
if (modifiedText == text) {
104
102
return replaceWithVarFormat(text, index, false )
105
103
}
106
104
return modifiedText
107
105
}
108
106
109
- private String replaceWithVarFormat (String text , int index , boolean longForm ) {
107
+ private static String replaceWithVarFormat (String text , int index , boolean longForm ) {
110
108
if (longForm) {
111
109
def pattern = compile(/ \$\s *\{\s */ + index + / \s *:\s *([^}]*)\s *}/ )
112
110
return text. replaceAll(pattern, / \$ / + index + / \$ / )
113
111
} else {
114
- def pattern = compile(/ \$\s */ + index)
112
+ def pattern = compile(/ \$\s */ + index)
115
113
return text. replaceAll(pattern, / \$ / + index + / \$ / )
116
114
}
117
115
}
118
116
119
- private Set<Match > parseAndGetMatches (String text ) {
117
+ private static Set<Match > parseAndGetMatches (String text ) {
120
118
def matches = parseAndGetMatches(text, true )
121
119
matches. addAll(parseAndGetMatches(text, false ))
122
120
return matches
123
121
}
124
122
125
- private Set<Match > parseAndGetMatches (String text , boolean longForm ) {
123
+ private static Set<Match > parseAndGetMatches (String text , boolean longForm ) {
126
124
Set<Match > matches = new TreeSet<> ()
127
125
if (longForm) {
128
126
def matcher = LONG_FORM_PATTERN . matcher(text)
0 commit comments