
net.jangaroo.jooc.mvnplugin.converter.TrailingCommasPrettyPrinter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jangaroo-maven-plugin Show documentation
Show all versions of jangaroo-maven-plugin Show documentation
This plugin compiles Jangaroo sources to JavaScript.
The newest version!
package net.jangaroo.jooc.mvnplugin.converter;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import java.io.IOException;
public class TrailingCommasPrettyPrinter extends PackageJsonPrettyPrinter {
public TrailingCommasPrettyPrinter() {
super();
}
@Override
public DefaultPrettyPrinter createInstance() {
return new TrailingCommasPrettyPrinter();
}
@Override
public void writeEndObject(JsonGenerator g, int nrOfEntries) throws IOException {
if (nrOfEntries > 0) {
g.writeRaw(_separators.getObjectEntrySeparator());
}
super.writeEndObject(g, nrOfEntries);
}
@Override
public void writeEndArray(JsonGenerator g, int nrOfValues) throws IOException {
if (nrOfValues > 0) {
g.writeRaw(_separators.getArrayValueSeparator());
}
super.writeEndArray(g, nrOfValues);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy