Skip to content

Commit 840f95b

Browse files
committed
Rename option variables
1 parent f1bdc42 commit 840f95b

File tree

2 files changed

+43
-43
lines changed

2 files changed

+43
-43
lines changed

src/main/java/org/scijava/table/io/ColumnTableIOOptions.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,25 +40,25 @@
4040
public class ColumnTableIOOptions extends AbstractOptions<ColumnTableIOOptions> {
4141

4242
public final ColumnTableIOOptions.Values values = new ColumnTableIOOptions.Values();
43-
private static final String parserId = "parser";
44-
private static final String formatterId = "formatter";
43+
private static final String parserKey = "parser";
44+
private static final String formatterKey = "formatter";
4545

4646
ColumnTableIOOptions formatter(Function<Object, String> formatter) {
47-
return setValue(formatterId, formatter);
47+
return setValue(formatterKey, formatter);
4848
}
4949

5050
ColumnTableIOOptions parser(Function<String, Object> parser) {
51-
return setValue(parserId, parser);
51+
return setValue(parserKey, parser);
5252
}
5353

5454
public class Values extends AbstractValues {
5555

5656
public Function<Object, String> formatter() {
57-
return getValueOrDefault(formatterId, String::valueOf);
57+
return getValueOrDefault(formatterKey, String::valueOf);
5858
}
5959

6060
public Function<String, Object> parser() {
61-
return getValueOrDefault(parserId, String::valueOf);
61+
return getValueOrDefault(parserKey, String::valueOf);
6262
}
6363
}
6464

src/main/java/org/scijava/table/io/TableIOOptions.java

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -43,22 +43,22 @@ public class TableIOOptions extends AbstractOptions<TableIOOptions> {
4343

4444
public final Values values = new Values();
4545
private final Map<Integer, ColumnTableIOOptions> columnOptions;
46-
private static final String readColHeadersId = "readColHeaders";
47-
private static final String columnOptionsId = "columnOptions";
48-
private static final String writeColHeadersId = "writeColHeaders";
49-
private static final String readRowHeadersId = "readRowHeaders";
50-
private static final String writeRowHeadersId = "writeRowHeaders";
51-
private static final String columnDelimiterId = "columnDelimiter";
52-
private static final String rowDelimiterId = "rowDelimiter";
53-
private static final String quoteId = "quote";
54-
private static final String cornerTextId = "cornerText";
55-
private static final String guessParserId = "guessParser";
56-
private static final String parserId = "parser";
57-
private static final String formatterId = "formatter";
46+
private static final String readColHeadersKey = "readColHeaders";
47+
private static final String columnOptionsKey = "columnOptions";
48+
private static final String writeColHeadersKey = "writeColHeaders";
49+
private static final String readRowHeadersKey = "readRowHeaders";
50+
private static final String writeRowHeadersKey = "writeRowHeaders";
51+
private static final String columnDelimiterKey = "columnDelimiter";
52+
private static final String rowDelimiterKey = "rowDelimiter";
53+
private static final String quoteKey = "quote";
54+
private static final String cornerTextKey = "cornerText";
55+
private static final String guessParserKey = "guessParser";
56+
private static final String parserKey = "parser";
57+
private static final String formatterKey = "formatter";
5858

5959
public TableIOOptions() {
6060
this.columnOptions = new HashMap<>();
61-
setValue(columnOptionsId, columnOptions);
61+
setValue(columnOptionsKey, columnOptions);
6262
}
6363

6464
/**
@@ -73,78 +73,78 @@ public static TableIOOptions options()
7373
* @param readColHeaders Whether to read the first column of the input file as column headers.
7474
*/
7575
public TableIOOptions readColumnHeaders(boolean readColHeaders) {
76-
return setValue(readColHeadersId, readColHeaders);
76+
return setValue(readColHeadersKey, readColHeaders);
7777
}
7878

7979
/**
8080
* @param writeColHeaders Whether to write column headers to file.
8181
*/
8282
public TableIOOptions writeColumnHeaders(boolean writeColHeaders) {
83-
return setValue(writeColHeadersId, writeColHeaders);
83+
return setValue(writeColHeadersKey, writeColHeaders);
8484
}
8585

8686
/**
8787
* @param readRowHeaders Whether to read the first column of the input file as row headers.
8888
*/
8989
public TableIOOptions readRowHeaders(boolean readRowHeaders) {
90-
return setValue(readRowHeadersId, readRowHeaders);
90+
return setValue(readRowHeadersKey, readRowHeaders);
9191
}
9292

9393
/**
9494
* @param writeRowHeaders Whether to write row headers to file.
9595
*/
9696
public TableIOOptions writeRowHeaders(boolean writeRowHeaders) {
97-
return setValue(writeRowHeadersId, writeRowHeaders);
97+
return setValue(writeRowHeadersKey, writeRowHeaders);
9898
}
9999

100100
/**
101101
* @param columnDelimiter Character separating cells in each row of the table.
102102
*/
103103
public TableIOOptions columnDelimiter(char columnDelimiter) {
104-
return setValue(columnDelimiterId, columnDelimiter);
104+
return setValue(columnDelimiterKey, columnDelimiter);
105105
}
106106

107107
/**
108108
* @param rowDelimiter Delimiter used at end of row when writing to or reading from file.
109109
*/
110110
public TableIOOptions rowDelimiter(String rowDelimiter) {
111-
return setValue(rowDelimiterId, rowDelimiter);
111+
return setValue(rowDelimiterKey, rowDelimiter);
112112
}
113113

114114
/**
115115
* @param quote Character used for escaping separator and empty strings.
116116
*/
117117
public TableIOOptions quote(char quote) {
118-
return setValue(quoteId, quote);
118+
return setValue(quoteKey, quote);
119119
}
120120

121121
/**
122122
* @param cornerText Text that appears at the top left corner when both column and row headers present.
123123
*/
124124
public TableIOOptions cornerText(String cornerText) {
125-
return setValue(cornerTextId, cornerText);
125+
return setValue(cornerTextKey, cornerText);
126126
}
127127

128128
/**
129129
* @param guessParser If true, allow opener to guess the data type of each column.
130130
*/
131131
public TableIOOptions guessParser(boolean guessParser) {
132-
return setValue(guessParserId, guessParser);
132+
return setValue(guessParserKey, guessParser);
133133
}
134134

135135
/**
136136
* @param parser Parser to use when converting table entries into data objects.
137137
*/
138138
public TableIOOptions parser(Function<String, Object> parser) {
139139
guessParser(false);
140-
return setValue(parserId, parser);
140+
return setValue(parserKey, parser);
141141
}
142142

143143
/**
144144
* @param formatter Formatter to use when writing data objects into table entries.
145145
*/
146146
public TableIOOptions formatter(Function<Object, String> formatter) {
147-
return setValue(formatterId, formatter);
147+
return setValue(formatterKey, formatter);
148148
}
149149

150150
/**
@@ -164,7 +164,7 @@ public TableIOOptions columnType(int column, Class<?> type) {
164164
ColumnTableIOOptions options = new ColumnTableIOOptions();
165165
columnOptions.putIfAbsent(column, options);
166166
options.formatter(String::valueOf).parser(getParser(type));
167-
return setValue(columnOptionsId, columnOptions);
167+
return setValue(columnOptionsKey, columnOptions);
168168
}
169169

170170
/**
@@ -204,85 +204,85 @@ public class Values extends AbstractValues
204204
* @return Whether to read the first column of the input file as row headers.
205205
*/
206206
public boolean readColumnHeaders() {
207-
return getValueOrDefault(readColHeadersId, true);
207+
return getValueOrDefault(readColHeadersKey, true);
208208
}
209209

210210
/**
211211
* @return Whether to write column headers to file.
212212
*/
213213
public boolean writeColumnHeaders() {
214-
return getValueOrDefault(writeColHeadersId, true);
214+
return getValueOrDefault(writeColHeadersKey, true);
215215
}
216216

217217
/**
218218
* @return Whether to read the first column of the input file as row headers.
219219
*/
220220
public boolean readRowHeaders() {
221-
return getValueOrDefault(readRowHeadersId, true);
221+
return getValueOrDefault(readRowHeadersKey, true);
222222
}
223223

224224
/**
225225
* @return Whether to write row headers to file.
226226
*/
227227
public boolean writeRowHeaders() {
228-
return getValueOrDefault(writeRowHeadersId, true);
228+
return getValueOrDefault(writeRowHeadersKey, true);
229229
}
230230

231231
/**
232232
* @return Character separating cells in each row of the table.
233233
*/
234234
public char columnDelimiter() {
235-
return getValueOrDefault(columnDelimiterId, ',');
235+
return getValueOrDefault(columnDelimiterKey, ',');
236236
}
237237

238238
/**
239239
* @return Delimiter used at end of row when writing to or reading from file.
240240
*/
241241
public String rowDelimiter() {
242-
return getValueOrDefault(rowDelimiterId, System.lineSeparator());
242+
return getValueOrDefault(rowDelimiterKey, System.lineSeparator());
243243
}
244244

245245
/**
246246
* @return Character used for escaping separator and empty strings.
247247
*/
248248
public char quote() {
249-
return getValueOrDefault(quoteId, '"');
249+
return getValueOrDefault(quoteKey, '"');
250250
}
251251

252252
/**
253253
* @return Text that appears at the top left corner when both column and row headers present.
254254
*/
255255
public String cornerText() {
256-
return getValueOrDefault(cornerTextId, "\\");
256+
return getValueOrDefault(cornerTextKey, "\\");
257257
}
258258

259259
/**
260260
* @return If true, allow opener to guess the data type of each column.
261261
*/
262262
public boolean guessParser() {
263-
return getValueOrDefault(guessParserId, true);
263+
return getValueOrDefault(guessParserKey, true);
264264
}
265265

266266
/**
267267
* @return Parser to use when converting table entries into data objects.
268268
*/
269269
public Function<String, Object> parser() {
270-
return getValueOrDefault(parserId, String::valueOf);
270+
return getValueOrDefault(parserKey, String::valueOf);
271271
}
272272

273273
/**
274274
* @return Formatter to use when writing data objects into table entries.
275275
*/
276276
public Function<Object, String> formatter() {
277-
return getValueOrDefault(formatterId, String::valueOf);
277+
return getValueOrDefault(formatterKey, String::valueOf);
278278
}
279279

280280
/**
281281
* @param column the index of the column
282282
* @return the values of this column's options
283283
*/
284284
public ColumnTableIOOptions.Values column(int column) {
285-
ColumnTableIOOptions columnOptions = getValueOrDefault(columnOptionsId, new HashMap<Integer, ColumnTableIOOptions>()).get(column);
285+
ColumnTableIOOptions columnOptions = getValueOrDefault(columnOptionsKey, new HashMap<Integer, ColumnTableIOOptions>()).get(column);
286286
if(columnOptions == null) return null;
287287
return columnOptions.values;
288288
}

0 commit comments

Comments
 (0)