All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.akquinet.jbosscc.guttenbase.defaults.impl.DefaultTableMapper Maven / Gradle / Ivy

The newest version!
package de.akquinet.jbosscc.guttenbase.defaults.impl;

import de.akquinet.jbosscc.guttenbase.hints.CaseConversionMode;
import de.akquinet.jbosscc.guttenbase.mapping.TableMapper;
import de.akquinet.jbosscc.guttenbase.meta.DatabaseMetaData;
import de.akquinet.jbosscc.guttenbase.meta.TableMetaData;

/**
 * By default prepend schema name.
 * 

* © 2012-2034 akquinet tech@spree *

* * @author M. Dahm */ public class DefaultTableMapper implements TableMapper { private final CaseConversionMode _caseConversionMode; public DefaultTableMapper(final CaseConversionMode caseConversionMode) { assert caseConversionMode != null : "caseConversionMode != null"; _caseConversionMode = caseConversionMode; } public DefaultTableMapper() { this(CaseConversionMode.NONE); } @Override public TableMetaData map(final TableMetaData source, final DatabaseMetaData targetDatabaseMetaData) { final String tableName = mapTableName(source, targetDatabaseMetaData); return targetDatabaseMetaData.getTableMetaData(tableName); } @Override public String fullyQualifiedTableName(final TableMetaData source, final DatabaseMetaData targetDatabaseMetaData) { final String schemaPrefix = targetDatabaseMetaData.getSchemaPrefix(); return schemaPrefix + mapTableName(source, targetDatabaseMetaData); } @Override public String mapTableName(final TableMetaData source, final DatabaseMetaData targetDatabaseMetaData) { return _caseConversionMode.convert(source.getTableName()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy