aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server/xmpp/router/Handshake.java
blob: 0bc501dd46d1d1a70c7e89e669f46c6aeef82a0b (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.juick.server.xmpp.router;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import java.io.IOException;

/**
 * Created by vitalyster on 30.01.2017.
 */
public class Handshake {
    private String value;

    public static Handshake parse(XmlPullParser parser) throws IOException, XmlPullParserException {
        parser.next();
        Handshake handshake = new Handshake();
        handshake.setValue(XmlUtils.getTagText(parser));
        return handshake;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public String toString() {
        StringBuilder str = new StringBuilder("<handshake");
        if (getValue() != null) {
            str.append(">").append(getValue()).append("</handshake>");
        } else {
            str.append("/>");
        }
        return str.toString();
    }
}