mirror of
https://github.com/plexusorg/Plex.git
synced 2025-07-04 16:56:40 +00:00
actually indent array types in toml
add a default config file instead of generation for commenting purposes add a random gradient placeholder and a converter for legacy colorcodes
This commit is contained in:
33
proxy/src/main/java/dev/plex/toml/TableArrayValueWriter.java
Normal file
33
proxy/src/main/java/dev/plex/toml/TableArrayValueWriter.java
Normal file
@ -0,0 +1,33 @@
|
||||
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();
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
||||
private TableArrayValueWriter() {}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "table-array";
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user