HHH-13495 Deprecate singleton access to NationalizedTypeMappings

This commit is contained in:
Sanne Grinovero 2019-07-10 19:10:08 +01:00 committed by gbadner
parent ab832caf0d
commit b37d6938fa
2 changed files with 17 additions and 3 deletions

View File

@ -617,7 +617,7 @@ public class SimpleValue implements KeyValue {
}
}
if ( isNationalized() ) {
jdbcTypeCode = NationalizedTypeMappings.INSTANCE.getCorrespondingNationalizedCode( jdbcTypeCode );
jdbcTypeCode = NationalizedTypeMappings.toNationalizedTypeCode( jdbcTypeCode );
}
// find the standard SqlTypeDescriptor for that JDBC type code (allow itr to be remapped if needed!)

View File

@ -16,18 +16,21 @@ import java.util.Map;
* corresponding nationalized equivalent, so that's all we implement for now
*
* @author Steve Ebersole
* @author Sanne Grinovero
*/
public class NationalizedTypeMappings {
public final class NationalizedTypeMappings {
/**
* Singleton access
* @deprecated use the static methods instead
*/
@Deprecated
public static final NationalizedTypeMappings INSTANCE = new NationalizedTypeMappings();
private NationalizedTypeMappings() {
}
public int getCorrespondingNationalizedCode(int jdbcCode) {
public static int toNationalizedTypeCode(final int jdbcCode) {
switch ( jdbcCode ) {
case Types.CHAR: return Types.NCHAR;
case Types.CLOB: return Types.NCLOB;
@ -37,4 +40,15 @@ public class NationalizedTypeMappings {
throw new IllegalArgumentException( "Unable to locate nationalized jdbc-code equivalent for given jdbc code : " + jdbcCode );
}
}
/**
* @deprecated use {@link #toNationalizedTypeCode(int)}
* @param jdbcCode
* @return
*/
@Deprecated
public int getCorrespondingNationalizedCode(int jdbcCode) {
return toNationalizedTypeCode( jdbcCode );
}
}