Package org.hibernate.type.internal
Class UserTypeJavaTypeWrapper<J>
- java.lang.Object
-
- org.hibernate.type.internal.UserTypeJavaTypeWrapper<J>
-
- All Implemented Interfaces:
Serializable,BasicJavaType<J>,JavaType<J>
- Direct Known Subclasses:
UserTypeVersionJavaTypeWrapper
public class UserTypeJavaTypeWrapper<J> extends Object implements BasicJavaType<J>
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classUserTypeJavaTypeWrapper.MutabilityPlanWrapper<J>-
Nested classes/interfaces inherited from interface org.hibernate.type.descriptor.java.JavaType
JavaType.CoercionContext
-
-
Constructor Summary
Constructors Constructor Description UserTypeJavaTypeWrapper(UserType<J> userType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanareEqual(J one, J another)Determine if two instances are equalintextractHashCode(J value)Extract a proper hash code for the given value.JfromString(CharSequence string)Comparator<J>getComparator()Retrieve the natural comparator for this type.longgetDefaultSqlLength(Dialect dialect, JdbcType jdbcType)The default column length when this Java type is mapped to a SQL data type which is parametrized by length, for exampleTypes.VARCHAR.intgetDefaultSqlPrecision(Dialect dialect, JdbcType jdbcType)The default column precision when this Java type is mapped to a SQL data type which is parametrized by precision, for exampleTypes.DECIMAL.intgetDefaultSqlScale(Dialect dialect, JdbcType jdbcType)The default column scale when this Java type is mapped to a SQL data type which is parametrized by scale, for exampleTypes.DECIMAL.Class<J>getJavaTypeClass()Get the Java type (theClassobject) described by thisJavaType.MutabilityPlan<J>getMutabilityPlan()Retrieve the mutability plan for this Java type.JdbcTypegetRecommendedJdbcType(JdbcTypeIndicators context)Obtain the "recommended"SQL type descriptorfor this Java type.StringtoString(J value)<X> Xunwrap(J value, Class<X> type, WrapperOptions options)Unwrap an instance of our handled Java type into the requested type.<X> Jwrap(X value, WrapperOptions options)Wrap a value as our handled Java type.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.hibernate.type.descriptor.java.JavaType
appendEncodedString, coerce, createJavaType, createJavaType, extractLoggableRepresentation, fromEncodedString, getDefaultValue, getJavaType, getLongSqlLength, getReplacement, isInstance, isTemporalType, isWider
-
-
-
-
Method Detail
-
getMutabilityPlan
public MutabilityPlan<J> getMutabilityPlan()
Description copied from interface:JavaTypeRetrieve the mutability plan for this Java type.- Specified by:
getMutabilityPlanin interfaceJavaType<J>
-
getRecommendedJdbcType
public JdbcType getRecommendedJdbcType(JdbcTypeIndicators context)
Description copied from interface:BasicJavaTypeObtain the "recommended"SQL type descriptorfor this Java type. Often, but not always, the source of this recommendation is the JDBC specification.- Specified by:
getRecommendedJdbcTypein interfaceBasicJavaType<J>- Specified by:
getRecommendedJdbcTypein interfaceJavaType<J>- Parameters:
context- Contextual information- Returns:
- The recommended SQL type descriptor
-
getDefaultSqlLength
public long getDefaultSqlLength(Dialect dialect, JdbcType jdbcType)
Description copied from interface:JavaTypeThe default column length when this Java type is mapped to a SQL data type which is parametrized by length, for exampleTypes.VARCHAR.- Specified by:
getDefaultSqlLengthin interfaceJavaType<J>- Returns:
Size.DEFAULT_LENGTHunless overridden
-
getDefaultSqlPrecision
public int getDefaultSqlPrecision(Dialect dialect, JdbcType jdbcType)
Description copied from interface:JavaTypeThe default column precision when this Java type is mapped to a SQL data type which is parametrized by precision, for exampleTypes.DECIMAL.- Specified by:
getDefaultSqlPrecisionin interfaceJavaType<J>- Returns:
Size.DEFAULT_PRECISIONunless overridden
-
getDefaultSqlScale
public int getDefaultSqlScale(Dialect dialect, JdbcType jdbcType)
Description copied from interface:JavaTypeThe default column scale when this Java type is mapped to a SQL data type which is parametrized by scale, for exampleTypes.DECIMAL.- Specified by:
getDefaultSqlScalein interfaceJavaType<J>- Returns:
Size.DEFAULT_SCALEunless overridden
-
getComparator
public Comparator<J> getComparator()
Description copied from interface:JavaTypeRetrieve the natural comparator for this type.- Specified by:
getComparatorin interfaceJavaType<J>
-
extractHashCode
public int extractHashCode(J value)
Description copied from interface:JavaTypeExtract a proper hash code for the given value.- Specified by:
extractHashCodein interfaceJavaType<J>- Parameters:
value- The value for which to extract a hash code.- Returns:
- The extracted hash code.
-
areEqual
public boolean areEqual(J one, J another)
Description copied from interface:JavaTypeDetermine if two instances are equal
-
fromString
public J fromString(CharSequence string)
- Specified by:
fromStringin interfaceBasicJavaType<J>- Specified by:
fromStringin interfaceJavaType<J>
-
unwrap
public <X> X unwrap(J value, Class<X> type, WrapperOptions options)
Description copied from interface:JavaTypeUnwrap an instance of our handled Java type into the requested type.As an example, if this is a
JavaType<Integer>and we are asked to unwrap theInteger valueas aLong, we would return something likeLong.valueOf( value.longValue() ).Intended use is during
PreparedStatementbinding.
-
wrap
public <X> J wrap(X value, WrapperOptions options)
Description copied from interface:JavaTypeWrap a value as our handled Java type.Intended use is during
ResultSetextraction.
-
getJavaTypeClass
public Class<J> getJavaTypeClass()
Description copied from interface:JavaTypeGet the Java type (theClassobject) described by thisJavaType.- Specified by:
getJavaTypeClassin interfaceJavaType<J>- See Also:
JavaType.getJavaType()
-
-