File D:\maven-qcr-plugin-testsunitaires\qcr4java\h2-1.3.170-sources\target\site\qc\lecode\mvstore\type\ObjectTypeFactory.java.html

1 /*
2 * Copyright 2004-2011 H2 Group. Multiple-Licensed under the H2 License, Version
3 * 1.0, and under the Eclipse Public License, Version 1.0
4 * (http://h2database.com/html/license.html). Initial Developer: H2 Group
5 */
6 package org.h2.mvstore.type;
7
8 import org.h2.mvstore.rtree.SpatialType;
9
10 /**
11 * A data type factory.
12 */
13 public class ObjectTypeFactory implements DataTypeFactory {
14
15 @Override
16 public void setParent(DataTypeFactory parent) {
17 // never called for this factory
18 }
19
20 @Override
21 public DataType buildDataType(String s) {
22 if ("s".equals(s)) {
23 return SpatialType.fromString(s);
24 } else if ("o".equals(s)) {
25 return new ObjectType();
26 }
27 return null;
28 }
29
30 @Override
31 public String getDataType(Class<?> objectClass) {
32 if (objectClass == SpatialType.class) {
33 return "s";
34 }
35 return "o";
36 }
37
38 }
39