summaryrefslogtreecommitdiffstats
blob: 5ca3ff8763e19d29c2da15d6feb181a1d66e0494 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * Copyright (c) 2010, Isode Limited, London, England.
 * All rights reserved.
 */
/*
 * Copyright (c) 2010, Remko Tronçon.
 * All rights reserved.
 */
package com.isode.stroke.serializer.payloadserializers;

import com.isode.stroke.elements.Body;
import com.isode.stroke.serializer.GenericPayloadSerializer;
import com.isode.stroke.serializer.xml.XMLTextNode;

/**
 * Body to String.
 */
public class BodySerializer extends GenericPayloadSerializer<Body> {

    public BodySerializer() {
        super(Body.class);
    }

    @Override
    protected String serializePayload(Body body) {
        XMLTextNode textNode = new XMLTextNode(body.getText());
        return "<body>" + textNode.serialize() + "</body>";
    }
}