01: /*
02: * Copyright 2007 Bastian Schenke Licensed under the Apache License, Version 2.0 (the "License");
03: * you may not use this file except in compliance with the License.
04: * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
05: * Unless required by applicable law or agreed to in writing, software distributed under the
06: * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
07: * either express or implied. See the License for the specific language governing permissions
08: * and limitations under the License.
09: */
10: package nz.org.take.r2ml;
11:
12: import javax.xml.namespace.QName;
13:
14: /**
15: * Defines a Mapping from qualified xml names to Java datatypes. Each type is
16: * identified by a <code>javax.xml.namespace.QName</code>.
17: *
18: * @author Bastian Schenke (bastian.schenke@googlemail.com)
19: *
20: */
21: public interface DatatypeMapper {
22:
23: /**
24: * Get the Class that is associated to the provided qualified name.
25: *
26: * @param classID
27: * a qualified name
28: * @return the java type associated with the qualified name
29: * <code>classID</code> or <code>null</code>
30: * @throws R2MLException if there is no datatype for the class-id
31: */
32: public Class getType(QName classID) throws R2MLException;
33:
34: /**
35: * Get the Class that is associated to the provided local name.
36: *
37: * @param classID
38: * a local name
39: * @return the java type associated with the local name
40: * <code>loacalName</code> or <code>null</code> if there is no
41: * type associated.
42: * @throws R2MLException if there is no datatype for the class-id
43: */
44: public Class getType(String localName) throws R2MLException;
45:
46: /**
47: * @param classID
48: * a fully qualified type name
49: * @param type
50: * a java type
51: */
52: public void setType(QName classID, Class type);
53:
54: /**
55: * @param localName
56: * a local type name
57: * @param type
58: * a java type
59: */
60: public void setType(String localName, Class type);
61:
62: }
|