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
ConstructorsModifierConstructorDescriptionprivate
TypeMapper
(Class<?> classe, int type, String keyword) For internal use only. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
keywordFor
(Class<?> classe) Returns the SQL keyword for storing an element of the given type, ornull
if unknown.static Class<?>
toJavaType
(int type) Return the Java class for the given SQL type, ornull
if 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 SQLTypes
enumeration. -
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, ornull
if unknown. This method does not handle the text type, soString
are 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 TABLE
statement.- Returns:
- the SQL keyword, or
null
if unknown.
-
toJavaType
Return the Java class for the given SQL type, ornull
if none.- Parameters:
type
- one of theTypes
constants.- Returns:
- the Java class, or
null
if none.
-