mirror of
https://github.com/plexusorg/toml4j.git
synced 2024-12-28 19:24:15 +00:00
Moved ValueConverterUtils.isComment(String) to ValueConverters
This commit is contained in:
parent
c0e78db681
commit
786529fce6
2 changed files with 21 additions and 28 deletions
|
@ -1,25 +0,0 @@
|
|||
package com.moandjiezana.toml;
|
||||
|
||||
|
||||
class ValueConverterUtils {
|
||||
|
||||
static boolean isComment(String line) {
|
||||
if (line == null || line.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char[] chars = line.toCharArray();
|
||||
|
||||
for (char c : chars) {
|
||||
if (Character.isWhitespace(c)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return c == '#';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private ValueConverterUtils() {}
|
||||
}
|
|
@ -16,9 +16,23 @@ class ValueConverters {
|
|||
|
||||
static final ValueConverters CONVERTERS = new ValueConverters();
|
||||
|
||||
private static final ValueConverter[] PARSERS = {
|
||||
MULTILINE_STRING_PARSER, MULTILINE_LITERAL_STRING_CONVERTER, LITERAL_STRING_PARSER, STRING_PARSER, DATE_PARSER, NUMBER_PARSER, BOOLEAN_PARSER, ARRAY_PARSER, INLINE_TABLE_PARSER
|
||||
};
|
||||
static boolean isComment(String line) {
|
||||
if (line == null || line.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
char[] chars = line.toCharArray();
|
||||
|
||||
for (char c : chars) {
|
||||
if (Character.isWhitespace(c)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return c == '#';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Object convert(String value, AtomicInteger index, Context context) {
|
||||
String substring = value.substring(index.get());
|
||||
|
@ -34,4 +48,8 @@ class ValueConverters {
|
|||
}
|
||||
|
||||
private ValueConverters() {}
|
||||
|
||||
private static final ValueConverter[] PARSERS = {
|
||||
MULTILINE_STRING_PARSER, MULTILINE_LITERAL_STRING_CONVERTER, LITERAL_STRING_PARSER, STRING_PARSER, DATE_PARSER, NUMBER_PARSER, BOOLEAN_PARSER, ARRAY_PARSER, INLINE_TABLE_PARSER
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue