summaryrefslogtreecommitdiffstats
blob: 8eff41ab0618cf882c125e8234afa12c6b29f81c (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
/*
 * Copyright (c) 2011-2013 Isode Limited, London, England.
 * All rights reserved.
 */
/*
 * Copyright (c) 2011 Kevin Smith
 * All rights reserved.
 */
package com.isode.stroke.serializer.payloadserializers;

import com.isode.stroke.elements.Last;
import com.isode.stroke.serializer.GenericPayloadSerializer;

public class LastSerializer extends GenericPayloadSerializer<Last> {

    public LastSerializer() {
        super(Last.class);
    }

    @Override
    protected String serializePayload(Last last) {
        if(last.getSeconds() == null) {
            return  "<query xmlns='jabber:iq:last'/>";
        }
        return "<query xmlns='jabber:iq:last' seconds='" + Long.toString(last.getSeconds()) + "'/>";
    }
}