summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/data/XmlProducer.java
blob: e0c93f79eb5a590093f77696c1d5c2b0e3887521 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.data;

/**
 * Generic API for classes that contain data representable as XML.
 */
public interface XmlProducer {

    /**
     * Append the XML representation of this object's data to a StringBuilder.
     * @param target the StringBuilder to append to.
     * @return the target passed in is also returned (to allow chaining).
     */
    StringBuilder writeXML(StringBuilder target);

    /**
     * Convenience method equivalent to:
     * makeXML(new StringBuilder()).toString()
     * @return String containing XML representation of this object's data.
     */
    String toXML();

}