Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,13 @@ public int streamWriteOutputBuffered() {
return -1;
}

@Override public AvroSchema getSchema() {
@Override
public PrettyPrinter getPrettyPrinter() {
return null;
}

@Override
public AvroSchema getSchema() {
return _rootSchema;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,11 @@ public int streamWriteOutputBuffered() {
return _outputTail;
}

@Override
public PrettyPrinter getPrettyPrinter() {
return null;
}

/*
/**********************************************************************
/* Overridden methods, output context (and related)
Expand Down
34 changes: 19 additions & 15 deletions ion/src/main/java/tools/jackson/dataformat/ion/IonGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ public class IonGenerator
*/
protected final Closeable _destination;

/**
* Object that handles pretty-printing (usually additional
* white space to make results more human-readable) during
* output. If null, no pretty-printing is done.
*/
protected PrettyPrinter _cfgPrettyPrinter;

/*
/**********************************************************************
/* State
Expand Down Expand Up @@ -195,6 +188,17 @@ public JacksonFeatureSet<StreamWriteCapability> streamWriteCapabilities() {
return DEFAULT_BINARY_WRITE_CAPABILITIES;
}

/*
/**********************************************************************
/* Config access
/**********************************************************************
*/

@Override
public PrettyPrinter getPrettyPrinter() {
return null;
}

/*
/**********************************************************************
/* JsonGenerator implementation: write numeric values
Expand Down Expand Up @@ -520,32 +524,32 @@ protected void _verifyValueWrite(String msg) throws JacksonException
// (Ion impl must do pretty-printing), so
/*
// Only additional work needed if we are pretty-printing
if (_cfgPrettyPrinter != null) {
if (_prettyPrinter != null) {
// If we have a pretty printer, it knows what to do:
switch (status) {
case JsonWriteContext.STATUS_OK_AFTER_COMMA: // array
_cfgPrettyPrinter.writeArrayValueSeparator(this);
_prettyPrinter.writeArrayValueSeparator(this);
break;
case JsonWriteContext.STATUS_OK_AFTER_COLON:
_cfgPrettyPrinter.writeObjectFieldValueSeparator(this);
_prettyPrinter.writeObjectFieldValueSeparator(this);
break;
case JsonWriteContext.STATUS_OK_AFTER_SPACE:
_cfgPrettyPrinter.writeRootValueSeparator(this);
_prettyPrinter.writeRootValueSeparator(this);
break;
case IonWriteContext.STATUS_OK_AFTER_SEXP_SEPARATOR:
// Special handling of sexp value separators can be added later. Root value
// separator will be whitespace which is sufficient to separate sexp values
_cfgPrettyPrinter.writeRootValueSeparator(this);
_prettyPrinter.writeRootValueSeparator(this);
break;
case JsonWriteContext.STATUS_OK_AS_IS:
// First entry, but of which context?
if (_outputContext.inArray()) {
_cfgPrettyPrinter.beforeArrayValues(this);
_prettyPrinter.beforeArrayValues(this);
} else if (_outputContext.inObject()) {
_cfgPrettyPrinter.beforeObjectEntries(this);
_prettyPrinter.beforeObjectEntries(this);
} else if(((IonWriteContext) _writeContext).inSexp()) {
// Format sexps like arrays
_cfgPrettyPrinter.beforeArrayValues(this);
_prettyPrinter.beforeArrayValues(this);
}
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,13 @@ public int streamWriteOutputBuffered() {
return -1;
}

@Override public ProtobufSchema getSchema() {
@Override
public PrettyPrinter getPrettyPrinter() {
return null;
}

@Override
public ProtobufSchema getSchema() {
return _schema;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,11 @@ public int streamWriteOutputBuffered() {
return _outputTail;
}

@Override
public PrettyPrinter getPrettyPrinter() {
return null;
}

/*
/**********************************************************************
/* Overridden methods, output context (and related)
Expand Down