HHH-13494 Deprecate singleton access in favour of static helpers

This commit is contained in:
Sanne Grinovero 2019-07-10 18:45:52 +01:00 committed by gbadner
parent cd3b76960e
commit 3088a2cfd0
2 changed files with 34 additions and 10 deletions

View File

@ -597,8 +597,8 @@ public class SimpleValue implements KeyValue {
); );
int jdbcTypeCode = recommendedSqlType.getSqlType(); int jdbcTypeCode = recommendedSqlType.getSqlType();
if ( isLob() ) { if ( isLob() ) {
if ( LobTypeMappings.INSTANCE.hasCorrespondingLobCode( jdbcTypeCode ) ) { if ( LobTypeMappings.isMappedToKnownLobCode( jdbcTypeCode ) ) {
jdbcTypeCode = LobTypeMappings.INSTANCE.getCorrespondingLobCode( jdbcTypeCode ); jdbcTypeCode = LobTypeMappings.getLobCodeTypeMapping( jdbcTypeCode );
} }
else { else {
if ( Serializable.class.isAssignableFrom( entityAttributeJavaTypeDescriptor.getJavaType() ) ) { if ( Serializable.class.isAssignableFrom( entityAttributeJavaTypeDescriptor.getJavaType() ) ) {

View File

@ -16,17 +16,41 @@ import org.hibernate.type.descriptor.JdbcTypeNameMapper;
* @author Steve Ebersole * @author Steve Ebersole
* @author Sanne Grinovero * @author Sanne Grinovero
*/ */
public class LobTypeMappings { public final class LobTypeMappings {
/** /**
* Singleton access * Singleton access
* @deprecated use the static method helpers instead.
*/ */
@Deprecated
public static final LobTypeMappings INSTANCE = new LobTypeMappings(); public static final LobTypeMappings INSTANCE = new LobTypeMappings();
private LobTypeMappings() { private LobTypeMappings() {
} }
/**
*
* @param jdbcTypeCode
* @return
* @deprecated use {@link #isMappedToKnownLobCode(int)}
*/
@Deprecated
public boolean hasCorrespondingLobCode(final int jdbcTypeCode) { public boolean hasCorrespondingLobCode(final int jdbcTypeCode) {
return isMappedToKnownLobCode( jdbcTypeCode );
}
/**
*
* @param jdbcTypeCode
* @return
* @deprecated use {@link #getLobCodeTypeMapping(int)}
*/
@Deprecated
public int getCorrespondingLobCode(final int jdbcTypeCode) {
return getLobCodeTypeMapping( jdbcTypeCode );
}
public static boolean isMappedToKnownLobCode(final int jdbcTypeCode) {
return return
// BLOB mappings // BLOB mappings
jdbcTypeCode == Types.BLOB || jdbcTypeCode == Types.BLOB ||
@ -47,7 +71,7 @@ public class LobTypeMappings {
jdbcTypeCode == Types.LONGNVARCHAR; jdbcTypeCode == Types.LONGNVARCHAR;
} }
public int getCorrespondingLobCode(final int jdbcTypeCode) { public static int getLobCodeTypeMapping(final int jdbcTypeCode) {
switch ( jdbcTypeCode ) { switch ( jdbcTypeCode ) {
// BLOB mappings // BLOB mappings