root / branches / v2_0_0_prep / libraries / libFMap_geometries / src / org / gvsig / fmap / geom / type / GeometryTypeNotSupportedException.java @ 21308
History | View | Annotate | Download (2.98 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.exceptions.BaseException; |
30 |
|
31 |
/**
|
32 |
* This exception is raised when the someone tries to access a geometry
|
33 |
* type that is not registered.
|
34 |
*
|
35 |
* @author jiyarza
|
36 |
*/
|
37 |
public class GeometryTypeNotSupportedException extends BaseException { |
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 |
/**
|
80 |
* Main constructor that provides both context data and a cause Exception
|
81 |
* @param geomClass geometry class
|
82 |
* @param e cause exception
|
83 |
*/
|
84 |
public GeometryTypeNotSupportedException(Class geomClass, Exception e) { |
85 |
messageKey = MESSAGE_KEY; |
86 |
formatString = FORMAT_STRING; |
87 |
code = serialVersionUID; |
88 |
|
89 |
if (e != null) { |
90 |
initCause(e); |
91 |
} |
92 |
|
93 |
if (geomClass != null) { |
94 |
this.geomClassName = geomClass.getName();
|
95 |
} |
96 |
} |
97 |
|
98 |
/*
|
99 |
* (non-Javadoc)
|
100 |
* @see org.gvsig.exceptions.BaseException#values()
|
101 |
*/
|
102 |
protected Map values() { |
103 |
HashMap map = new HashMap(); |
104 |
map.put("geomClassName", geomClassName);
|
105 |
return map;
|
106 |
} |
107 |
} |