Subversion Repositories XServices

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12 brianR 1
/*
13 brianR 2
 *   Copyright 2010 Brian Rosenberger (Brutex Network)
3
 *
4
 *   Licensed under the Apache License, Version 2.0 (the "License");
5
 *   you may not use this file except in compliance with the License.
6
 *   You may obtain a copy of the License at
7
 *
8
 *       http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 *   Unless required by applicable law or agreed to in writing, software
11
 *   distributed under the License is distributed on an "AS IS" BASIS,
12
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 *   See the License for the specific language governing permissions and
14
 *   limitations under the License.
12 brianR 15
 */
16
package net.brutex.xservices.types;
17
 
18
import java.util.ArrayList;
19
import java.util.List;
20
import java.util.Map;
21
import javax.xml.bind.annotation.XmlElement;
22
import javax.xml.bind.annotation.XmlRootElement;
23
 
24
/**
22 brianR 25
 * Generic key/ value pairs.
12 brianR 26
 *
22 brianR 27
 * @author Brian Rosenberger
12 brianR 28
 */
29
@XmlRootElement
30
public class AntProperty {
31
 
22 brianR 32
    /**
33
     * Key of the entry.
34
     */
12 brianR 35
    @XmlElement(required=true)
36
    public String name ="";
37
 
22 brianR 38
    /**
39
     * Value of the entry.
40
     */
12 brianR 41
    @XmlElement(required=true)
42
    public String value="";
43
 
22 brianR 44
    /**
45
     * Converts a Map<String, String> into a list of
46
     * AntProperties.
47
     * @param map   The map to convert
48
     * @return      A list of key/value pairs
49
     */
12 brianR 50
    public static List<AntProperty> createAntPropertyList(Map<String, String> map) {
51
        List<AntProperty> list = new ArrayList<AntProperty>();
52
        for(Map.Entry<String, String> e : map.entrySet()) {
53
            list.add(new AntProperty(e.getKey(), e.getValue()));
54
        }
55
        return list;
56
    }
57
 
22 brianR 58
    /**
59
     * Creates a new AntProperty.
60
     * @param name
61
     * @param value
62
     */
12 brianR 63
    public AntProperty(String name, String value) {
64
        this.name = name;
65
        this.value = value;
66
    }
67
 
22 brianR 68
    /**
69
     * Creates a new AntProperty.
70
     */
12 brianR 71
    public AntProperty() {
72
    }
73
 
74
 
75
}