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 booleanareEqual(C one, C another)Determine if two instances are equalintextractHashCode(C value)Extract a proper hash code for the given value.StringextractLoggableRepresentation(C value)Extract a loggable representation of the given value.CfromString(CharSequence charSequence)JavaType<E>getElementJavaType()Get the Java type descriptor for the element typeJdbcTypegetRecommendedJdbcType(JdbcTypeIndicators indicators)Obtain the "recommended"SQL type descriptorfor this Java type.CollectionSemantics<C,E>getSemantics()booleanisWider(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 typeStringtoString(C value)<X> Xunwrap(C value, Class<X> type, WrapperOptions options)Unwrap an instance of our handled Java type into the requested type.<X> Cwrap(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:BasicPluralJavaTypeGet the Java type descriptor for the element type- Specified by:
getElementJavaTypein interfaceBasicPluralJavaType<C extends Collection<E>>
-
getRecommendedJdbcType
public JdbcType getRecommendedJdbcType(JdbcTypeIndicators indicators)
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<C extends Collection<E>>- Specified by:
getRecommendedJdbcTypein 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:JavaTypeDetermines 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:
isWiderin interfaceJavaType<C extends Collection<E>>
-
resolveType
public BasicType<?> resolveType(TypeConfiguration typeConfiguration, Dialect dialect, BasicType<E> elementType, ColumnTypeInformation columnTypeInformation, JdbcTypeIndicators stdIndicators)
Description copied from interface:BasicPluralJavaTypeCreates a container type for the given element type- Specified by:
resolveTypein interfaceBasicPluralJavaType<C extends Collection<E>>
-
extractLoggableRepresentation
public String extractLoggableRepresentation(C value)
Description copied from interface:JavaTypeExtract a loggable representation of the given value.- Specified by:
extractLoggableRepresentationin interfaceJavaType<C extends Collection<E>>- Overrides:
extractLoggableRepresentationin 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:JavaTypeDetermine if two instances are equal- Specified by:
areEqualin interfaceJavaType<C extends Collection<E>>- Overrides:
areEqualin 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:JavaTypeExtract a proper hash code for the given value.- Specified by:
extractHashCodein interfaceJavaType<C extends Collection<E>>- Overrides:
extractHashCodein 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:
toStringin interfaceJavaType<C extends Collection<E>>
-
fromString
public C fromString(CharSequence charSequence)
- Specified by:
fromStringin interfaceBasicJavaType<C extends Collection<E>>- Specified by:
fromStringin interfaceJavaType<C extends Collection<E>>
-
unwrap
public <X> X unwrap(C 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.- Specified by:
unwrapin 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:JavaTypeWrap a value as our handled Java type.Intended use is during
ResultSetextraction.- Specified by:
wrapin interfaceJavaType<C extends Collection<E>>- Type Parameters:
X- The conversion type.- Parameters:
value- The value to wrap.options- The options- Returns:
- The wrapped value.
-
-