public class TypeMap extends Object
<typemaps type="LONG">
<typemap type="LONG">
<map db="java" type="BIGINT" />
<map db="postgresql" type="BIGINT" />
<map db="oracle" type="NUMBER(19,0)" />
</typemap>
</typemaps>
The database name of "java" represents JDBC SQL types. The other database names are those that are returned by the
different implementations of DatabaseType.getName().
Instances of this object are created via loadTypeMapsFromStream(InputStream) and
loadKnownTypeMaps().
| Modifier and Type | Method and Description |
|---|---|
static String |
getMappedType(Collection<TypeMap> typemaps,
String generic_type,
DatabaseType database)
Given a collection of generic type maps, this returns the database specific type for the given generic type.
|
String |
getMappedType(String generic_type,
DatabaseType database)
If this type map defines database types for the given generic type, this returns the type for the given database.
|
static Collection<TypeMap> |
loadKnownTypeMaps()
Loads in the known type maps.
|
static Collection<TypeMap> |
loadTypeMapsFromStream(InputStream xml_stream)
Given an input stream that contains an XML file of type maps, this will load in those type maps.
|
String |
toString() |
public String getMappedType(String generic_type, DatabaseType database)
null is returned.
The database name (which is unique to a vendor/version) is first used to look up the type. If none is found, simply the vendor name is used to look up the type. This allows the XML to define a default type for all versions of a specific database vendor; but if a type needs to be different for a specific version of the vendor database, this allows for that.
Ifdatabase is null, this means you are asking for a non-vendor-specific map type; in
other words, the JDBC SQL type.generic_type - database - null if the type is not found within this object.public String toString()
toString in class ObjectObject.toString()public static String getMappedType(Collection<TypeMap> typemaps, String generic_type, DatabaseType database)
database is null, this means you are asking for a non-vendor-specific map type; in
other words, the JDBC SQL type.typemaps - collection of mappings for multiple generic typesgeneric_type - the generic type name whose corresponding database specific type is to be returneddatabase - null is returned if
there is no database specific mappingpublic static Collection<TypeMap> loadKnownTypeMaps()
IllegalStateException - if the known XML file could not be loaded (should never occur) or was invalidpublic static Collection<TypeMap> loadTypeMapsFromStream(InputStream xml_stream) throws Exception
xml_stream - the stream containing the XML mapping (must not be null)NullPointerException - if xml_stream is nullException - if the type maps data was invalidCopyright © 2008-2014 Red Hat, Inc.. All Rights Reserved.