svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / type / GeometryTypeNotSupportedException.java @ 33681
History | View | Annotate | Download (3.29 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 |
package org.gvsig.fmap.geom.type; |
25 |
|
26 |
import java.util.HashMap; |
27 |
import java.util.Map; |
28 |
|
29 |
import org.gvsig.fmap.geom.GeometryException; |
30 |
|
31 |
/**
|
32 |
* This exception is raised when the someone tries to access a geometry
|
33 |
* type that is not supported.
|
34 |
*
|
35 |
* @author jiyarza
|
36 |
*/
|
37 |
public class GeometryTypeNotSupportedException extends GeometryException { |
38 |
|
39 |
/**
|
40 |
* Generated serial version UID
|
41 |
*/
|
42 |
private static final long serialVersionUID = -196778635358286969L; |
43 |
|
44 |
/**
|
45 |
* Key to retrieve this exception's message
|
46 |
*/
|
47 |
private static final String MESSAGE_KEY = "geometry_type_not_supported_exception"; |
48 |
/**
|
49 |
* This exception's message. Substitution fields follow the format %(fieldName) and
|
50 |
* must be stored in the Map returned by the values() method.
|
51 |
*/
|
52 |
private static final String FORMAT_STRING = |
53 |
"The geometry class %(geomClassName) is not registered.";
|
54 |
|
55 |
/**
|
56 |
* Class name of the geometry type. Should never be null in this exception
|
57 |
*/
|
58 |
private String geomClassName = null; |
59 |
|
60 |
|
61 |
/**
|
62 |
* Constructor with some context data for cases in which the root cause of
|
63 |
* <code>this</code> is internal (usually an unsatisfied logic rule).
|
64 |
* @param geomClass geometry class
|
65 |
*/
|
66 |
public GeometryTypeNotSupportedException(Class geomClass){ |
67 |
this(geomClass, null); |
68 |
} |
69 |
|
70 |
/**
|
71 |
* Constructor to use when <code>this</code> is caused by another Exception
|
72 |
* but there is not further context data available.
|
73 |
* @param e cause exception
|
74 |
*/
|
75 |
public GeometryTypeNotSupportedException(Exception e) { |
76 |
this(null, e); |
77 |
} |
78 |
|
79 |
public GeometryTypeNotSupportedException(int type, int subType){ |
80 |
super(
|
81 |
"Geometry type %(type), %(subType) not supported.",
|
82 |
"_geometry_type_XtypeX_XsubTypeX_not_supported",
|
83 |
serialVersionUID |
84 |
); |
85 |
setValue("type", new Integer(type)); |
86 |
setValue("subType", new Integer(subType)); |
87 |
} |
88 |
|
89 |
public GeometryTypeNotSupportedException(String geomClassName){ |
90 |
super(FORMAT_STRING, MESSAGE_KEY, serialVersionUID);
|
91 |
|
92 |
if (geomClassName != null) { |
93 |
setValue("geomClassName", geomClassName);
|
94 |
} |
95 |
} |
96 |
|
97 |
/**
|
98 |
* Main constructor that provides both context data and a cause Exception
|
99 |
* @param geomClass geometry class
|
100 |
* @param e cause exception
|
101 |
*/
|
102 |
public GeometryTypeNotSupportedException(Class geomClass, Exception e) { |
103 |
super(FORMAT_STRING, e, MESSAGE_KEY, serialVersionUID);
|
104 |
|
105 |
if (geomClass != null) { |
106 |
setValue("geomClassName", geomClass.getName());
|
107 |
} |
108 |
} |
109 |
} |