Skip to content

Commit 9e43ba8

Browse files
committed
reduce scope where possible
1 parent dba3b1c commit 9e43ba8

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

libs/dissect/src/main/java/org/elasticsearch/dissect/DissectKey.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,13 @@ public String toString() {
166166
this.modifier = modifier;
167167
}
168168

169+
//package private for testing
169170
static Modifier fromString(String modifier) {
170171
return EnumSet.allOf(Modifier.class).stream().filter(km -> km.modifier.equals(modifier))
171172
.findFirst().orElseThrow(() -> new IllegalArgumentException("Found invalid modifier.")); //throw should never happen
172173
}
173174

174-
static Modifier findModifier(String key) {
175+
private static Modifier findModifier(String key) {
175176
Modifier modifier = Modifier.NONE;
176177
if (key != null && !key.isEmpty()) {
177178
Matcher matcher = MODIFIER_PATTERN.matcher(key);

libs/dissect/src/main/java/org/elasticsearch/dissect/DissectMatch.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,19 @@ Map<String, String> getResults() {
126126
/**
127127
* a result that will need to be part of an append operation.
128128
*/
129-
final class AppendResult {
129+
private final class AppendResult {
130130
private final List<AppendValue> values = new ArrayList<>();
131131
private final String appendSeparator;
132132

133-
AppendResult(String appendSeparator) {
133+
private AppendResult(String appendSeparator) {
134134
this.appendSeparator = appendSeparator;
135135
}
136136

137-
void addValue(String value, int order) {
137+
private void addValue(String value, int order) {
138138
values.add(new AppendValue(value, order));
139139
}
140140

141-
String getAppendResult() {
141+
private String getAppendResult() {
142142
Collections.sort(values);
143143
return values.stream().map(AppendValue::getValue).collect(Collectors.joining(appendSeparator));
144144
}
@@ -147,20 +147,20 @@ String getAppendResult() {
147147
/**
148148
* An appendable value that can be sorted based on the provided order
149149
*/
150-
final class AppendValue implements Comparable<AppendValue> {
150+
private final class AppendValue implements Comparable<AppendValue> {
151151
private final String value;
152152
private final int order;
153153

154-
AppendValue(String value, int order) {
154+
private AppendValue(String value, int order) {
155155
this.value = value;
156156
this.order = order;
157157
}
158158

159-
String getValue() {
159+
private String getValue() {
160160
return value;
161161
}
162162

163-
int getOrder() {
163+
private int getOrder() {
164164
return order;
165165
}
166166

@@ -173,25 +173,25 @@ public int compareTo(AppendValue o) {
173173
/**
174174
* A result that needs to be converted to a key/value reference
175175
*/
176-
final class ReferenceResult {
176+
private final class ReferenceResult {
177177

178178
private String key;
179179

180-
String getKey() {
180+
private String getKey() {
181181
return key;
182182
}
183183

184-
String getValue() {
184+
private String getValue() {
185185
return value;
186186
}
187187

188188
private String value;
189189

190-
void setValue(String value) {
190+
private void setValue(String value) {
191191
this.value = value;
192192
}
193193

194-
void setKey(String key) {
194+
private void setKey(String key) {
195195
this.key = key;
196196
}
197197
}

libs/dissect/src/main/java/org/elasticsearch/dissect/DissectParser.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,24 +285,23 @@ public Map<String, String> parse(String inputString) {
285285
/**
286286
* A tuple class to hold the dissect key and delimiter
287287
*/
288-
class DissectPair {
288+
private class DissectPair {
289289

290290
private final DissectKey key;
291291
private final String delimiter;
292292

293-
DissectPair(DissectKey key, String delimiter) {
293+
private DissectPair(DissectKey key, String delimiter) {
294294
this.key = key;
295295
this.delimiter = delimiter;
296296
}
297297

298-
DissectKey getKey() {
298+
private DissectKey getKey() {
299299
return key;
300300
}
301301

302-
String getDelimiter() {
302+
private String getDelimiter() {
303303
return delimiter;
304304
}
305-
306305
}
307306

308307
}

0 commit comments

Comments
 (0)