Class BooleanJavaType
- All Implemented Interfaces:
Serializable, BasicJavaType<Boolean>, JavaType<Boolean>, PrimitiveJavaType<Boolean>
Boolean handling.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface JavaType
JavaType.CoercionContext -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfromEncodedString(CharSequence charSequence, int start, int end) Reads the encoded value from the char sequence start index until the end index and returns the decoded value.fromString(CharSequence string) Get the Java type that describes an array of this type.getCheckCondition(String columnName, JdbcType jdbcType, BasicValueConverter<Boolean, ?> converter, Dialect dialect) The check constraint that should be added to the column definition in generated DDL.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.Get this Java type's default value.Class<?> Get the Java type that describes an array of this type's primitive variant.Class<?> Retrieve the primitive counterpart to the wrapper type identified by this descriptorbooleanisInstance(Object value) Is the given value an instance of the described type?int<X> Xunwrap(Boolean value, Class<X> type, WrapperOptions options) Unwrap an instance of our handled Java type into the requested type.booleanWhether to useObject.equals(Object)andObject.hashCode()orJavaType.areEqual(Object, Object)andJavaType.extractHashCode(Object)for objects of this java type.<X> Booleanwrap(X value, WrapperOptions options) Wrap a value as our handled Java type.Methods inherited from class AbstractClassJavaType
areEqual, extractHashCode, extractLoggableRepresentation, getComparator, getJavaType, getJavaTypeClass, getMutabilityPlan, unknownUnwrap, unknownWrapMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BasicJavaType
getRecommendedJdbcTypeMethods inherited from interface JavaType
appendEncodedString, areEqual, coerce, createJavaType, extractHashCode, extractLoggableRepresentation, fromEncodedString, getComparator, getJavaType, getJavaTypeClass, getLongSqlLength, getMutabilityPlan, getReplacement, getTypeName, isTemporalType, isWider
-
Field Details
-
INSTANCE
-
-
Constructor Details
-
BooleanJavaType
public BooleanJavaType() -
BooleanJavaType
public BooleanJavaType(char characterValueTrue, char characterValueFalse)
-
-
Method Details
-
useObjectEqualsHashCode
public boolean useObjectEqualsHashCode()Description copied from interface:JavaTypeWhether to useObject.equals(Object)andObject.hashCode()orJavaType.areEqual(Object, Object)andJavaType.extractHashCode(Object)for objects of this java type. This is useful to avoid mega-morphic callsites.- Specified by:
useObjectEqualsHashCodein interfaceJavaType<Boolean>
-
toString
-
fromString
- Specified by:
fromStringin interfaceBasicJavaType<Boolean>- Specified by:
fromStringin interfaceJavaType<Boolean>
-
isInstance
Description copied from interface:JavaTypeIs the given value an instance of the described type?Usually just
getJavaTypeClass().isInstance(value), but some descriptors need specialized semantics, for example, the descriptors forjava.sql.Date,java.sql.Time, andjava.sql.Timestamp.For
EntityJavaType, this method handles proxies in a semantically correct way, by checking the entity instance underlying the proxy object.- Specified by:
isInstancein interfaceJavaType<Boolean>
-
cast
Description copied from interface:JavaTypeApply a simple type cast to the given value, without attempting any sort of coercion or wrapping. This method is provided as a convenient way to avoid an unchecked cast to a type variable. UsejavaType.cast(value)instead of(T) valuewherever possible.Usually just
getJavaTypeClass().cast(value), but overridden in some cases as an "optimization". This optimization is almost certainly unnecessary, and might even indeed be harmful, sinceClass.cast()is an intrinsic. -
fromEncodedString
Description copied from interface:JavaTypeReads the encoded value from the char sequence start index until the end index and returns the decoded value. Implementers do not need to care about escaping. This is similar toJavaType.fromString(CharSequence), with the difference that the aim of this method is decoding from a range within an existing char sequence.- Specified by:
fromEncodedStringin interfaceJavaType<Boolean>
-
unwrap
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
-
toInt
-
toByte
-
toShort
-
toInteger
-
toLong
-
getPrimitiveClass
Description copied from interface:PrimitiveJavaTypeRetrieve the primitive counterpart to the wrapper type identified by this descriptor- Specified by:
getPrimitiveClassin interfacePrimitiveJavaType<Boolean>- Returns:
- The primitive Java type.
-
getArrayClass
Description copied from interface:PrimitiveJavaTypeGet the Java type that describes an array of this type.- Specified by:
getArrayClassin interfacePrimitiveJavaType<Boolean>
-
getPrimitiveArrayClass
Description copied from interface:PrimitiveJavaTypeGet the Java type that describes an array of this type's primitive variant.- Specified by:
getPrimitiveArrayClassin interfacePrimitiveJavaType<Boolean>
-
getDefaultValue
Description copied from interface:JavaTypeGet this Java type's default value.- Specified by:
getDefaultValuein interfaceJavaType<Boolean>- Returns:
- The default value.
-
getDefaultSqlLength
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<Boolean>- Returns:
Size.DEFAULT_LENGTHunless overridden
-
getDefaultSqlPrecision
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<Boolean>- Returns:
Size.DEFAULT_PRECISIONunless overridden
-
getDefaultSqlScale
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<Boolean>- Returns:
Size.DEFAULT_SCALEunless overridden
-
getCheckCondition
public String getCheckCondition(String columnName, JdbcType jdbcType, BasicValueConverter<Boolean, ?> converter, Dialect dialect) Description copied from interface:JavaTypeThe check constraint that should be added to the column definition in generated DDL.- Specified by:
getCheckConditionin interfaceJavaType<Boolean>- Parameters:
columnName- the name of the columnjdbcType- theJdbcTypeof the mapped columnconverter- the converter, if any, or nulldialect- the SQLDialect- Returns:
- a check constraint condition or null
-