mirror of
https://github.com/plexusorg/toml4j.git
synced 2024-06-26 16:00:46 +00:00
72941c146d
Set the default indentation to 0.
28 lines
677 B
Java
28 lines
677 B
Java
package com.moandjiezana.toml;
|
|
|
|
import java.util.Collection;
|
|
|
|
import static com.moandjiezana.toml.ValueWriters.WRITERS;
|
|
|
|
class TableArrayValueWriter extends ArrayValueWriter {
|
|
static final ValueWriter TABLE_ARRAY_VALUE_WRITER = new TableArrayValueWriter();
|
|
|
|
@Override
|
|
public boolean canWrite(Object value) {
|
|
return isArrayish(value) && !isArrayOfPrimitive(value);
|
|
}
|
|
|
|
@Override
|
|
public void write(Object value, WriterContext context) {
|
|
Collection values = normalize(value);
|
|
|
|
WriterContext subContext = context.pushTableFromArray();
|
|
|
|
for (Object elem : values) {
|
|
WRITERS.write(elem, subContext);
|
|
}
|
|
}
|
|
|
|
private TableArrayValueWriter() {}
|
|
}
|