Class TypeMapper
java.lang.Object
org.apache.sis.internal.metadata.sql.TypeMapper
Maps a few basic Java types to JDBC types.
- Since:
- 0.8
- Version:
- 0.8
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateTypeMapper(Class<?> classe, int type, String keyword) For internal use only. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringkeywordFor(Class<?> classe) Returns the SQL keyword for storing an element of the given type, ornullif unknown.static Class<?>toJavaType(int type) Return the Java class for the given SQL type, ornullif none.
-
Field Details
-
TYPES
A list of Java classes to be mapped to SQL types. We do not want to map every SQL types, but only the ones which are of interest for the Apache SIS metadata implementation. The types will be tested in the order they are declared, so the last declarations are fallbacks.The types declared here matches both the Derby and PostgreSQL mapping.
-
classe
The Java class. -
type
private final int typeA constant from the SQLTypesenumeration. -
keyword
The SQL keyword for that type.
-
-
Constructor Details
-
TypeMapper
For internal use only.
-
-
Method Details
-
keywordFor
Returns the SQL keyword for storing an element of the given type, ornullif unknown. This method does not handle the text type, soStringare treated as "unknown" as well. We do that way because the caller will need to specify a value inVARCHAR(n)statement.- Parameters:
classe- the class for which to get the SQL keyword in aCREATE TABLEstatement.- Returns:
- the SQL keyword, or
nullif unknown.
-
toJavaType
Return the Java class for the given SQL type, ornullif none.- Parameters:
type- one of theTypesconstants.- Returns:
- the Java class, or
nullif none.
-