freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UserInfo.java
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Tue, 14 Sep 2010 08:56:13 +0200
changeset 264 d60370059c3c
parent 146 0b889d9e4ee1
permissions -rw-r--r--
Changing headers to GPLv3
jaroslav@146
     1
/*
jaroslav@264
     2
 * Quoridor server and related libraries
jaroslav@264
     3
 * Copyright (C) 2009-2010 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
jaroslav@146
     4
 *
jaroslav@264
     5
 * This program is free software: you can redistribute it and/or modify
jaroslav@264
     6
 * it under the terms of the GNU General Public License as published by
jaroslav@264
     7
 * the Free Software Foundation, either version 3 of the License.
jaroslav@146
     8
 *
jaroslav@264
     9
 * This program is distributed in the hope that it will be useful,
jaroslav@264
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
jaroslav@264
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
jaroslav@264
    12
 * GNU General Public License for more details.
jaroslav@146
    13
 *
jaroslav@264
    14
 * You should have received a copy of the GNU General Public License
jaroslav@264
    15
 * along with this program. Look for COPYING file in the top folder.
jaroslav@264
    16
 * If not, see http://www.gnu.org/licenses/.
jaroslav@146
    17
 */
jaroslav@146
    18
package cz.xelfi.quoridor.freemarkerdor;
jaroslav@146
    19
jaroslav@146
    20
import java.util.List;
jaroslav@146
    21
import javax.xml.bind.annotation.XmlAccessType;
jaroslav@146
    22
import javax.xml.bind.annotation.XmlAccessorType;
jaroslav@146
    23
import javax.xml.bind.annotation.XmlAttribute;
jaroslav@146
    24
import javax.xml.bind.annotation.XmlElement;
jaroslav@146
    25
import javax.xml.bind.annotation.XmlRootElement;
jaroslav@146
    26
import javax.xml.bind.annotation.XmlValue;
jaroslav@146
    27
jaroslav@146
    28
/**
jaroslav@146
    29
 *
jaroslav@146
    30
 * @author Jaroslav Tulach <jtulach@netbeans.org>
jaroslav@146
    31
 */
jaroslav@146
    32
@XmlRootElement(name="user")
jaroslav@146
    33
@XmlAccessorType(XmlAccessType.NONE)
jaroslav@146
    34
public final class UserInfo extends Object {
jaroslav@146
    35
    @XmlAttribute
jaroslav@146
    36
    private String id;
jaroslav@146
    37
    @XmlElement(name="property")
jaroslav@146
    38
    private List<Property> properties;
jaroslav@146
    39
jaroslav@146
    40
    UserInfo() {
jaroslav@146
    41
    }
jaroslav@146
    42
jaroslav@146
    43
    public UserInfo(String id) {
jaroslav@146
    44
        this.id = id;
jaroslav@146
    45
    }
jaroslav@146
    46
jaroslav@146
    47
    public String getProperty(String name) {
jaroslav@146
    48
        if (properties == null) {
jaroslav@146
    49
            return null;
jaroslav@146
    50
        }
jaroslav@146
    51
        for (Property p : properties) {
jaroslav@146
    52
            if (p.name.equals(name)) {
jaroslav@146
    53
                return p.value;
jaroslav@146
    54
            }
jaroslav@146
    55
        }
jaroslav@146
    56
        return null;
jaroslav@146
    57
    }
jaroslav@146
    58
jaroslav@146
    59
    public String getId() {
jaroslav@146
    60
        return id;
jaroslav@146
    61
    }
jaroslav@146
    62
jaroslav@146
    63
    public static final class Property {
jaroslav@146
    64
        @XmlAttribute
jaroslav@146
    65
        private String name;
jaroslav@146
    66
        @XmlValue
jaroslav@146
    67
        private String value;
jaroslav@146
    68
jaroslav@146
    69
        private Property() {
jaroslav@146
    70
        }
jaroslav@146
    71
jaroslav@146
    72
        Property(String name, String value) {
jaroslav@146
    73
            this.name = name;
jaroslav@146
    74
            this.value = value;
jaroslav@146
    75
        }
jaroslav@146
    76
    }
jaroslav@146
    77
}