Statistics
| Revision:

gvsig-tools / org.gvsig.tools / library / trunk / org.gvsig.tools / org.gvsig.tools.lib / src / main / java / org / gvsig / tools / dataTypes / DataTypesManager.java @ 697

History | View | Annotate | Download (2.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
package org.gvsig.tools.dataTypes;
23

    
24
import java.util.Iterator;
25

    
26
/**
27
 * Manages data types.
28
 * 
29
 * @author gvSIG Team
30
 * @version $Id$
31
 */
32
public interface DataTypesManager {
33

    
34
    public interface Coercion {
35

    
36
        public Object coerce(Object value) throws CoercionException;
37
    }
38

    
39
    public DataType get(int type);
40

    
41
    public boolean isValidType(int type);
42

    
43
    public boolean isObject(int type);
44

    
45
    public boolean isContainer(int type);
46

    
47
    public String getTypeName(int type);
48

    
49
    public int getType(String name);
50

    
51
    public Class getDefaultClass(int type);
52

    
53
    /**
54
     * Returns a DataType whose default class is the one provided.
55
     * As there may be more than one {@link DataType} objects with the same
56
     * default class, it will return only one of them.
57
     * 
58
     * @param defaultClass
59
     *            the default class of the data type asked
60
     * @return the DataType whose default class is the one provided.
61
     */
62
    public DataType getDataType(Class defaultClass);
63

    
64
    public String getSubtype(int type);
65

    
66
    public int addtype(int type, String subtype, String name,
67
        Class defaultClass, Coercion coercion);
68

    
69
    public Coercion getCoercion(int type);
70

    
71
    public void setCoercion(int type, Coercion coercion);
72

    
73
    public void addCoercion(int type, Coercion coercion);
74

    
75
    public Object coerce(int type, Object value) throws CoercionException;
76

    
77
    public Iterator iterator();
78

    
79
}