- * The datetime support is more extended than in the TOML specification. This reader supports three kind of datetimes:
- *
- *
Full RFC 3339. Examples: 1979-05-27T07:32:00Z, 1979-05-27T00:32:00-07:00, 1979-05-27T00:32:00.999999-07:00
- *
Without local offset. Examples: 1979-05-27T07:32:00, 1979-05-27T00:32:00.999999
- *
Without time (just the date). Example: 2015-03-20
- *
- * Moreover, parsing datetimes gives different objects according to the informations provided. For example, 2015-03-20
- * is parsed as a {@link LocalDate}, 2015-03-20T19:04:35 as a {@link LocalDateTime}, and 2015-03-20T19:04:35+01:00 as a
- * {@link ZonedDateTime}.
- *
- * This library allows "lenient" bare keys by default, as opposite to the "strict" bare keys required by the TOML
- * specification. Strict bare keys may only contain letters, numbers, underscores, and dashes (A-Za-z0-9_-). Lenient
- * bare keys may contain any character except those below the space character ' ' in the unicode table, '.', '[', ']'
- * and '='. The behaviour of TomlReader regarding bare keys is set in its constructor.
- *
+ * 此类支持更加宽松的key,除了{@code A-Za-z0-9_- },还支持' ','.', '[', ']' 和 '='
*
* @author TheElectronWill
- *
*/
public class TomlReader {
@@ -54,8 +44,8 @@ public class TomlReader {
/**
* Creates a new TomlReader.
*
- * @param data the TOML data to read
- * @param strictAsciiBareKeys true to allow only strict bare keys, {@code false} to allow lenient ones.
+ * @param data the TOML data to read
+ * @param strictAsciiBareKeys {@code true} to allow only strict bare keys, {@code false} to allow lenient ones.
*/
public TomlReader(final String data, final boolean strictAsciiBareKeys) {
this.data = data;
@@ -155,6 +145,7 @@ public class TomlReader {
}
}
+ @SuppressWarnings("unchecked")
public Map read() {
final Map map = nextTableContent();
@@ -249,16 +240,16 @@ public class TomlReader {
childMap = new HashMap<>(4);
valueMap.put(part, childMap);
} else if (child instanceof Map) {// table
- childMap = (Map) child;
+ childMap = (Map) child;
} else {// array
- final List