Refactor NormalizedNodeWriter
[netconf.git] / restconf / restconf-nb / src / main / java / org / opendaylight / restconf / server / api / DatabindFormattableBody.java
index 71daa7645ecb96d7094be287730ea5aa03b1f85e..8d5308a0f983eb3374cc10b63260e57f26398819 100644 (file)
@@ -12,39 +12,33 @@ import static java.util.Objects.requireNonNull;
 import java.io.IOException;
 import java.io.OutputStream;
 import org.eclipse.jdt.annotation.NonNullByDefault;
-import org.opendaylight.restconf.api.FormatParameters;
 import org.opendaylight.restconf.api.FormattableBody;
+import org.opendaylight.restconf.api.query.PrettyPrintParam;
 
 /**
  * A {@link FormattableBody} which has an attached {@link DatabindContext}.
  */
 @NonNullByDefault
-public abstract class DatabindFormattableBody extends FormattableBody implements DatabindAware {
+public abstract class DatabindFormattableBody extends FormattableBody {
     private final DatabindContext databind;
 
-    protected DatabindFormattableBody(final FormatParameters format, final DatabindContext databind) {
-        super(format);
+    protected DatabindFormattableBody(final DatabindContext databind) {
         this.databind = requireNonNull(databind);
     }
 
     @Override
-    public final DatabindContext databind() {
-        return databind;
+    public final void formatToJSON(final PrettyPrintParam prettyPrint, final OutputStream out) throws IOException {
+        formatToJSON(databind, prettyPrint, out);
     }
 
-    @Override
-    protected final void formatToJSON(final OutputStream out, final FormatParameters format) throws IOException {
-        formatToJSON(out, format, databind());
-    }
-
-    protected abstract void formatToJSON(OutputStream out, FormatParameters format, DatabindContext databind)
+    protected abstract void formatToJSON(DatabindContext databind, PrettyPrintParam prettyPrint, OutputStream out)
         throws IOException;
 
     @Override
-    protected final void formatToXML(final OutputStream out, final FormatParameters format) throws IOException {
-        formatToXML(out, format, databind());
+    public final void formatToXML(final PrettyPrintParam prettyPrint, final OutputStream out) throws IOException {
+        formatToXML(databind, prettyPrint, out);
     }
 
-    protected abstract void formatToXML(OutputStream out, FormatParameters format, DatabindContext databind)
+    protected abstract void formatToXML(DatabindContext databind, PrettyPrintParam prettyPrint, OutputStream out)
         throws IOException;
 }