gvsig-vectorediting / org.gvsig.vectorediting / trunk / org.gvsig.vectorediting / org.gvsig.vectorediting.lib / org.gvsig.vectorediting.lib.spi / src / main / java / org / gvsig / vectorediting / lib / spi / DefaultEditingServiceParameter.java @ 2616
History | View | Annotate | Download (5.39 KB)
1 |
/**
|
---|---|
2 |
* gvSIG. Desktop Geographic Information System.
|
3 |
*
|
4 |
* Copyright ? 2007-2014 gvSIG Association
|
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 |
* For any additional information, do not hesitate to contact us
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
23 |
*/
|
24 |
|
25 |
package org.gvsig.vectorediting.lib.spi; |
26 |
|
27 |
import java.util.Arrays; |
28 |
import java.util.HashSet; |
29 |
import java.util.Map; |
30 |
import java.util.Set; |
31 |
import org.gvsig.fmap.geom.Geometry; |
32 |
import org.gvsig.vectorediting.lib.api.EditingServiceParameter; |
33 |
|
34 |
public class DefaultEditingServiceParameter implements EditingServiceParameter { |
35 |
|
36 |
private String name; |
37 |
|
38 |
private String description; |
39 |
|
40 |
private Set<TYPE> types; |
41 |
|
42 |
private int geometryType; |
43 |
|
44 |
private Map<String, String> options; |
45 |
|
46 |
private Object defaultValue; |
47 |
|
48 |
private boolean optional; |
49 |
|
50 |
public DefaultEditingServiceParameter(String theName, |
51 |
String theDescription, TYPE... theTypes) {
|
52 |
|
53 |
this(theName, theDescription, Geometry.TYPES.NULL, null, null, false, theTypes); |
54 |
|
55 |
} |
56 |
|
57 |
public DefaultEditingServiceParameter(String theName, |
58 |
String theDescription, boolean optional, TYPE... theTypes) { |
59 |
|
60 |
this(theName, theDescription, Geometry.TYPES.NULL, null, null, optional, theTypes); |
61 |
} |
62 |
|
63 |
public DefaultEditingServiceParameter(String theName, |
64 |
String theDescription, Map<String, String> options, Object defaultValue, boolean optional, TYPE... theTypes) { |
65 |
|
66 |
this(theName, theDescription, Geometry.TYPES.NULL, options, defaultValue, optional, theTypes);
|
67 |
} |
68 |
|
69 |
public DefaultEditingServiceParameter(String theName, |
70 |
Object theDefaultValue, String theDescription, TYPE... theTypes) { |
71 |
|
72 |
this(theName, theDescription, Geometry.TYPES.NULL, null, theDefaultValue, false, theTypes); |
73 |
|
74 |
} |
75 |
|
76 |
public DefaultEditingServiceParameter(String theName, |
77 |
String theDescription, int theGeometryType, TYPE... theTypes) { |
78 |
|
79 |
this(theName, theDescription, theGeometryType, null, null, false, theTypes); |
80 |
|
81 |
} |
82 |
|
83 |
public DefaultEditingServiceParameter(String theName, |
84 |
String theDescription, Object theDefaultValue, int theGeometryType, |
85 |
TYPE... theTypes) { |
86 |
|
87 |
this(theName, theDescription, theGeometryType, null, theDefaultValue, false, theTypes); |
88 |
|
89 |
} |
90 |
|
91 |
public DefaultEditingServiceParameter(String theName, |
92 |
String theDescription, Map<String, String> theOptions, TYPE... theTypes) { |
93 |
|
94 |
this(theName, theDescription, Geometry.TYPES.NULL, theOptions, null, false, theTypes); |
95 |
} |
96 |
|
97 |
public DefaultEditingServiceParameter(String theName, |
98 |
String theDescription, Map<String, String> theOptions, Object theDefaultValue, TYPE... theTypes) { |
99 |
|
100 |
this(theName, theDescription, Geometry.TYPES.NULL, theOptions, theDefaultValue, false, theTypes); |
101 |
} |
102 |
|
103 |
public DefaultEditingServiceParameter(String theName, |
104 |
String theDescription, int theGeometryType, |
105 |
Map<String, String> theOptions, TYPE... theTypes) { |
106 |
|
107 |
this(theName, theDescription, theGeometryType, theOptions, null, false, theTypes); |
108 |
|
109 |
} |
110 |
|
111 |
public DefaultEditingServiceParameter(String theName, |
112 |
String theDescription, int theGeometryType, |
113 |
Map<String, String> theOptions, Object theDefaultValue, TYPE... theTypes) { |
114 |
|
115 |
this(theName, theDescription, theGeometryType, theOptions, theDefaultValue, false, theTypes); |
116 |
} |
117 |
|
118 |
public DefaultEditingServiceParameter(String theName, |
119 |
String theDescription, int theGeometryType, |
120 |
Map<String, String> theOptions, Object theDefaultValue, |
121 |
boolean optional, TYPE... theTypes) {
|
122 |
|
123 |
this.name = theName;
|
124 |
this.description = theDescription;
|
125 |
this.geometryType = theGeometryType;
|
126 |
|
127 |
this.types = new HashSet<>(); |
128 |
this.types.addAll(Arrays.asList(theTypes)); |
129 |
|
130 |
this.options = theOptions;
|
131 |
this.defaultValue = theDefaultValue;
|
132 |
this.optional = optional;
|
133 |
} |
134 |
|
135 |
@Override
|
136 |
public Set<TYPE> getTypes() { |
137 |
return types;
|
138 |
} |
139 |
|
140 |
@Override
|
141 |
public String getName() { |
142 |
return name;
|
143 |
} |
144 |
|
145 |
@Override
|
146 |
public String getDescription() { |
147 |
return description;
|
148 |
} |
149 |
|
150 |
public void setDescription(String newDescription) { |
151 |
this.description = newDescription;
|
152 |
} |
153 |
|
154 |
@Override
|
155 |
public int getGeometryType() { |
156 |
return this.geometryType; |
157 |
} |
158 |
|
159 |
@Override
|
160 |
public Map<String, String> getOptions() { |
161 |
return this.options; |
162 |
} |
163 |
|
164 |
@Override
|
165 |
public Object getDefaultValue() { |
166 |
return this.defaultValue; |
167 |
} |
168 |
|
169 |
@Override
|
170 |
public void setDefaultValue(Object value) { |
171 |
this.defaultValue = value;
|
172 |
} |
173 |
|
174 |
@Override
|
175 |
public boolean isOptional() { |
176 |
return optional;
|
177 |
} |
178 |
|
179 |
public void setOptional(boolean optional) { |
180 |
this.optional = optional;
|
181 |
} |
182 |
|
183 |
} |