This commit is contained in:
2022-05-10 00:08:45 -05:00
parent 770fe65f98
commit bb8c34e0cd
74 changed files with 2025 additions and 1556 deletions

View File

@ -1,33 +1,38 @@
package dev.plex.toml;
import java.util.Collection;
import static dev.plex.toml.ValueWriters.WRITERS;
class TableArrayValueWriter extends ArrayValueWriter
{
static final ValueWriter TABLE_ARRAY_VALUE_WRITER = new TableArrayValueWriter();
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 from, WriterContext context) {
Collection<?> values = normalize(from);
WriterContext subContext = context.pushTableFromArray();
for (Object value : values) {
WRITERS.findWriterFor(value).write(value, subContext);
@Override
public boolean canWrite(Object value)
{
return isArrayish(value) && !isArrayOfPrimitive(value);
}
}
private TableArrayValueWriter() {}
@Override
public void write(Object from, WriterContext context)
{
Collection<?> values = normalize(from);
@Override
public String toString() {
return "table-array";
}
WriterContext subContext = context.pushTableFromArray();
for (Object value : values)
{
WRITERS.findWriterFor(value).write(value, subContext);
}
}
private TableArrayValueWriter()
{
}
@Override
public String toString()
{
return "table-array";
}
}