// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.result;

import com.yahoo.data.access.Inspector;
import com.yahoo.data.access.Inspectable;
import com.yahoo.data.access.simple.JsonRender;
import com.yahoo.data.JsonProducer;
import com.yahoo.data.XmlProducer;
import com.yahoo.prelude.hitfield.XmlRenderer;

/**
 * A wrapper for structured data representing feature values.
 */
public class StructuredData implements Inspectable, JsonProducer, XmlProducer {

    private final Inspector value;

    public StructuredData(Inspector value) {
        this.value = value;
    }

    @Override
    public Inspector inspect() {
        return value;
    }

    public String toString() {
        return toXML();
    }

    @Override
    public String toXML() {
        return writeXML(new StringBuilder()).toString();
    }

    @Override
    public StringBuilder writeXML(StringBuilder target) {
        return XmlRenderer.render(target, value);
    }

    @Override
    public String toJson() {
        return writeJson(new StringBuilder()).toString();
    }

    @Override
    public StringBuilder writeJson(StringBuilder target) {
        return JsonRender.render(value, target, true);
    }

}

@@ -804,114 +804,8 @@
  %7D%0A%0A
-    @Override%0A    public String toXML() %7B%0A        return writeXML(new StringBuilder()).toString();%0A    %7D%0A%0A
     

use deafult toXML implementation