Class BasicCollectionJavaType<C extends Collection<E>,E>
- java.lang.Object
-
- org.hibernate.type.descriptor.java.AbstractJavaType<C>
-
- org.hibernate.type.descriptor.java.spi.BasicCollectionJavaType<C,E>
-
- All Implemented Interfaces:
Serializable
,BasicJavaType<C>
,BasicPluralJavaType<E>
,JavaType<C>
@Incubating public class BasicCollectionJavaType<C extends Collection<E>,E> extends AbstractJavaType<C> implements BasicPluralJavaType<E>
Descriptor for handling persistent collections.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.hibernate.type.descriptor.java.JavaType
JavaType.CoercionContext
-
-
Constructor Summary
Constructors Constructor Description BasicCollectionJavaType(ParameterizedType type, JavaType<E> componentJavaType, CollectionSemantics<C,E> semantics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
areEqual(C one, C another)
Determine if two instances are equalint
extractHashCode(C value)
Extract a proper hash code for the given value.String
extractLoggableRepresentation(C value)
Extract a loggable representation of the given value.C
fromString(CharSequence charSequence)
JavaType<E>
getElementJavaType()
Get the Java type descriptor for the element typeJdbcType
getRecommendedJdbcType(JdbcTypeIndicators indicators)
Obtain the "recommended"SQL type descriptor
for this Java type.CollectionSemantics<C,E>
getSemantics()
boolean
isWider(JavaType<?> javaType)
Determines if this Java type is wider than the given Java type, that is, if the given type can be safely widened to this type.BasicType<?>
resolveType(TypeConfiguration typeConfiguration, Dialect dialect, BasicType<E> elementType, ColumnTypeInformation columnTypeInformation, JdbcTypeIndicators stdIndicators)
Creates a container type for the given element typeString
toString(C value)
<X> X
unwrap(C value, Class<X> type, WrapperOptions options)
Unwrap an instance of our handled Java type into the requested type.<X> C
wrap(X value, WrapperOptions options)
Wrap a value as our handled Java type.-
Methods inherited from class org.hibernate.type.descriptor.java.AbstractJavaType
getComparator, getJavaType, getMutabilityPlan, unknownUnwrap, unknownWrap
-
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, fromEncodedString, getCheckCondition, getDefaultSqlLength, getDefaultSqlPrecision, getDefaultSqlScale, getDefaultValue, getJavaTypeClass, getLongSqlLength, getReplacement, getTypeName, isInstance, isTemporalType, useObjectEqualsHashCode
-
-
-
-
Constructor Detail
-
BasicCollectionJavaType
public BasicCollectionJavaType(ParameterizedType type, JavaType<E> componentJavaType, CollectionSemantics<C,E> semantics)
-
-
Method Detail
-
getElementJavaType
public JavaType<E> getElementJavaType()
Description copied from interface:BasicPluralJavaType
Get the Java type descriptor for the element type- Specified by:
getElementJavaType
in interfaceBasicPluralJavaType<C extends Collection<E>>
-
getRecommendedJdbcType
public JdbcType getRecommendedJdbcType(JdbcTypeIndicators indicators)
Description copied from interface:BasicJavaType
Obtain the "recommended"SQL type descriptor
for this Java type. Often, but not always, the source of this recommendation is the JDBC specification.- Specified by:
getRecommendedJdbcType
in interfaceBasicJavaType<C extends Collection<E>>
- Specified by:
getRecommendedJdbcType
in interfaceJavaType<C extends Collection<E>>
- Parameters:
indicators
- Contextual information- Returns:
- The recommended SQL type descriptor
-
getSemantics
public CollectionSemantics<C,E> getSemantics()
-
isWider
public boolean isWider(JavaType<?> javaType)
Description copied from interface:JavaType
Determines if this Java type is wider than the given Java type, that is, if the given type can be safely widened to this type.- Specified by:
isWider
in interfaceJavaType<C extends Collection<E>>
-
resolveType
public BasicType<?> resolveType(TypeConfiguration typeConfiguration, Dialect dialect, BasicType<E> elementType, ColumnTypeInformation columnTypeInformation, JdbcTypeIndicators stdIndicators)
Description copied from interface:BasicPluralJavaType
Creates a container type for the given element type- Specified by:
resolveType
in interfaceBasicPluralJavaType<C extends Collection<E>>
-
extractLoggableRepresentation
public String extractLoggableRepresentation(C value)
Description copied from interface:JavaType
Extract a loggable representation of the given value.- Specified by:
extractLoggableRepresentation
in interfaceJavaType<C extends Collection<E>>
- Overrides:
extractLoggableRepresentation
in classAbstractJavaType<C extends Collection<E>>
- Parameters:
value
- The value for which to extract a loggable representation.- Returns:
- The loggable representation
-
areEqual
public boolean areEqual(C one, C another)
Description copied from interface:JavaType
Determine if two instances are equal- Specified by:
areEqual
in interfaceJavaType<C extends Collection<E>>
- Overrides:
areEqual
in classAbstractJavaType<C extends Collection<E>>
- Parameters:
one
- One instanceanother
- The other instance- Returns:
- True if the two are considered equal; false otherwise.
-
extractHashCode
public int extractHashCode(C value)
Description copied from interface:JavaType
Extract a proper hash code for the given value.- Specified by:
extractHashCode
in interfaceJavaType<C extends Collection<E>>
- Overrides:
extractHashCode
in classAbstractJavaType<C extends Collection<E>>
- Parameters:
value
- The value for which to extract a hash code.- Returns:
- The extracted hash code.
-
toString
public String toString(C value)
- Specified by:
toString
in interfaceJavaType<C extends Collection<E>>
-
fromString
public C fromString(CharSequence charSequence)
- Specified by:
fromString
in interfaceBasicJavaType<C extends Collection<E>>
- Specified by:
fromString
in interfaceJavaType<C extends Collection<E>>
-
unwrap
public <X> X unwrap(C value, Class<X> type, WrapperOptions options)
Description copied from interface:JavaType
Unwrap 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 value
as aLong
, we would return something likeLong.valueOf( value.longValue() )
.Intended use is during
PreparedStatement
binding.- Specified by:
unwrap
in interfaceJavaType<C extends Collection<E>>
- Type Parameters:
X
- The conversion type.- Parameters:
value
- The value to unwraptype
- The type as which to unwrapoptions
- The options- Returns:
- The unwrapped value.
-
wrap
public <X> C wrap(X value, WrapperOptions options)
Description copied from interface:JavaType
Wrap a value as our handled Java type.Intended use is during
ResultSet
extraction.- Specified by:
wrap
in interfaceJavaType<C extends Collection<E>>
- Type Parameters:
X
- The conversion type.- Parameters:
value
- The value to wrap.options
- The options- Returns:
- The wrapped value.
-
-