Subversion Repositories XServices

Rev

Rev 13 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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