Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libGeocoding / src / org / gvsig / geocoding / address / impl / DefaultAddressComponent.java @ 28375

History | View | Annotate | Download (2.69 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
5
 * 
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 2
9
 * of the License, or (at your option) any later version.
10
 * 
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 * 
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
19
 * MA  02110-1301, USA.
20
 * 
21
 */
22

    
23
/*
24
 * AUTHORS (In addition to CIT):
25
 * 2008 Prodevelop S.L. main development
26
 */
27

    
28
package org.gvsig.geocoding.address.impl;
29

    
30
import org.gvsig.geocoding.address.AddressComponent;
31
import org.gvsig.tools.persistence.PersistenceException;
32
import org.gvsig.tools.persistence.PersistentState;
33

    
34
/**
35
 * AddresComponent class implementation, this class has the keys of the extension (elements)
36
 * and the values that to define a address
37
 * 
38
 * @author <a href="mailto:jsanz@prodevelop.es"> Jorge Gaspar Sanz Salinas</a>
39
 * @author <a href="mailto:vsanjaime@prodevelop.es"> Vicente Sanjaime Calvet</a>
40
 */
41

    
42
public class DefaultAddressComponent implements AddressComponent {
43

    
44
        private static final String ELEMENT = "element";
45
        private static final String VALUE = "value";
46

    
47
        private String element;
48
        private String value;
49

    
50
        /**
51
         * AddressComponent constructor
52
         * 
53
         * @param element
54
         * @param value
55
         */
56
        public DefaultAddressComponent(String element, String value) {
57
                this.element = element;
58
                this.value = value;
59
        }
60

    
61
        /**
62
         * get key element
63
         * 
64
         * @return
65
         */
66
        public String getKeyElement() {
67
                return element;
68
        }
69

    
70
        /**
71
         * get value
72
         * 
73
         * @return
74
         */
75
        public String getValue() {
76
                return value;
77
        }
78

    
79
        /**
80
         * Saves the internal state of the object on the provided PersistentState
81
         * object.
82
         * 
83
         * @param state
84
         */
85
        public void saveToState(PersistentState state) throws PersistenceException {
86
                state.set(ELEMENT, this.element);
87
                state.set(VALUE, this.value);
88

    
89
        }
90

    
91
        /**
92
         * Set the state of the object from the state passed as parameter.
93
         * 
94
         * @param state
95
         */
96
        public void setState(PersistentState state) throws PersistenceException {
97
                this.element = (String) state.get(ELEMENT);
98
                this.value = (String) state.get(VALUE);
99
        }
100

    
101
}