Subversion Repositories XServices

Rev

Rev 181 | Details | Compare with Previous | 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
 */
82 brianR 16
package net.brutex.xservices.types.ant;
12 brianR 17
 
18
import java.util.ArrayList;
19
import java.util.List;
20
import java.util.Map;
181 brianR 21
 
12 brianR 22
import javax.xml.bind.annotation.XmlElement;
23
import javax.xml.bind.annotation.XmlRootElement;
24
 
25
/**
22 brianR 26
 * Generic key/ value pairs.
12 brianR 27
 *
22 brianR 28
 * @author Brian Rosenberger
12 brianR 29
 */
30
@XmlRootElement
31
public class AntProperty {
32
 
22 brianR 33
    /**
34
     * Key of the entry.
35
     */
12 brianR 36
    @XmlElement(required=true)
37
    public String name ="";
38
 
22 brianR 39
    /**
40
     * Value of the entry.
41
     */
12 brianR 42
    @XmlElement(required=true)
43
    public String value="";
44
 
22 brianR 45
    /**
46
     * Converts a Map<String, String> into a list of
47
     * AntProperties.
181 brianR 48
     * @param newMap   The map to convert
22 brianR 49
     * @return      A list of key/value pairs
50
     */
181 brianR 51
    public static List<AntProperty> createAntPropertyList(Map<String, Object> newMap) {
12 brianR 52
        List<AntProperty> list = new ArrayList<AntProperty>();
181 brianR 53
        for(Map.Entry<String, Object> e : newMap.entrySet()) {
54
            list.add(new AntProperty(e.getKey(), (String)e.getValue()));
12 brianR 55
        }
56
        return list;
57
    }
58
 
22 brianR 59
    /**
60
     * Creates a new AntProperty.
61
     * @param name
62
     * @param value
63
     */
12 brianR 64
    public AntProperty(String name, String value) {
65
        this.name = name;
66
        this.value = value;
67
    }
68
 
22 brianR 69
    /**
70
     * Creates a new AntProperty.
71
     */
12 brianR 72
    public AntProperty() {
73
    }
74
 
75
 
76
}