root / trunk / libraries / libMetadata / src / org / gvsig / metadata / simple / SimpleMetadata.java @ 20940
History | View | Annotate | Download (2.87 KB)
1 | 20940 | allaves | /* 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 Geographic Information research group: http://www.geoinfo.uji.es
|
||
26 | * Departamento de Lenguajes y Sistemas Inform?ticos (LSI)
|
||
27 | * Universitat Jaume I
|
||
28 | * {{Task}}
|
||
29 | */
|
||
30 | |||
31 | package org.gvsig.metadata.simple; |
||
32 | |||
33 | import java.util.Date; |
||
34 | import java.util.HashMap; |
||
35 | import java.util.Map; |
||
36 | |||
37 | import org.gvsig.metadata.Metadata; |
||
38 | |||
39 | public class SimpleMetadata implements Metadata { |
||
40 | |||
41 | private Map elements = new HashMap(); |
||
42 | private String definitionName; |
||
43 | |||
44 | public SimpleMetadata(String definitionName) { |
||
45 | this.definitionName = definitionName;
|
||
46 | } |
||
47 | |||
48 | public Object get(String name) { |
||
49 | return elements.get(name);
|
||
50 | } |
||
51 | |||
52 | public boolean getBoolean(String name) throws ClassCastException { |
||
53 | return ((Boolean)elements.get(name)).booleanValue(); |
||
54 | } |
||
55 | |||
56 | public double getDouble(String name) throws ClassCastException { |
||
57 | return ((Double)elements.get(name)).doubleValue(); |
||
58 | } |
||
59 | |||
60 | public int getInt(String name) throws ClassCastException { |
||
61 | return ((Integer)elements.get(name)).intValue(); |
||
62 | } |
||
63 | |||
64 | public String getString(String name) throws ClassCastException { |
||
65 | return (String)elements.get(name).toString(); |
||
66 | } |
||
67 | |||
68 | public Date getDate(String name) throws ClassCastException { |
||
69 | return (Date)elements.get(name); |
||
70 | } |
||
71 | |||
72 | public void set(String name, Object value) { |
||
73 | elements.put(name, value); |
||
74 | } |
||
75 | |||
76 | public void setBoolean(String name, boolean value) { |
||
77 | elements.put(name, Boolean.valueOf(value));
|
||
78 | } |
||
79 | |||
80 | public void setDouble(String name, double value) { |
||
81 | elements.put(name, Double.valueOf(value));
|
||
82 | } |
||
83 | |||
84 | public void setInt(String name, int value) { |
||
85 | elements.put(name, Integer.valueOf(value));
|
||
86 | } |
||
87 | |||
88 | public void setString(String name, String value) { |
||
89 | elements.put(name, String.valueOf(value));
|
||
90 | } |
||
91 | |||
92 | public void setDate(String name, Date value) { |
||
93 | elements.put(name, value); |
||
94 | } |
||
95 | |||
96 | public boolean hasValue(String name) { |
||
97 | return elements.containsKey(name);
|
||
98 | } |
||
99 | |||
100 | public boolean isEmpty() { |
||
101 | return elements.isEmpty();
|
||
102 | } |
||
103 | |||
104 | } |