Package org.hibernate.type
Interface CompositeType
-
- All Superinterfaces:
Serializable
,Type
- All Known Subinterfaces:
CompositeTypeImplementor
- All Known Implementing Classes:
AnyType
,ComponentType
,EmbeddedComponentType
,ProcessorSessionFactory.Component
,UserComponentType
public interface CompositeType extends Type
Represents a composite type, a type which itself has typed attributes.For example, a type representing an embeddable class is a composite type, as is a type backed by a
CompositeUserType
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description CascadeStyle
getCascadeStyle(int index)
Retrieve the cascade style of the indicated component property.FetchMode
getFetchMode(int index)
Retrieve the fetch mode of the indicated component property.int
getPropertyIndex(String propertyName)
Convenience method for locating the property index for a given property name.String[]
getPropertyNames()
Get the names of the component propertiesboolean[]
getPropertyNullability()
Retrieve the indicators regarding which component properties are nullable.Object
getPropertyValue(Object component, int index, SharedSessionContractImplementor session)
Extract a particular component property value indicated by index.Object[]
getPropertyValues(Object component)
Extract the values of the component properties from the given component instance without access to the session.Object[]
getPropertyValues(Object component, SharedSessionContractImplementor session)
Extract the values of the component properties from the given component instanceType[]
getSubtypes()
Get the types of the component propertiesboolean
hasNotNullProperty()
Convenience method to quickly checkgetPropertyNullability()
for any non-nullable sub-properties.default boolean
hasNullProperty()
Convenience method to quickly check ifgetPropertyNullability()
contains a nullable sub-properties.boolean
isEmbedded()
Is this component embedded? "embedded" indicates that the component is "virtual", that its properties are "flattened" onto its ownerboolean
isMethodOf(Method method)
Is the given method a member of this component's class?default Object
replacePropertyValues(Object component, Object[] values, SharedSessionContractImplementor session)
Inject property values onto the given component instance, or return a new instance with the given property values.void
setPropertyValues(Object component, Object[] values)
Inject property values onto the given component instance-
Methods inherited from interface org.hibernate.type.Type
assemble, beforeAssemble, compare, compare, deepCopy, disassemble, disassemble, getColumnSpan, getHashCode, getHashCode, getName, getReturnedClass, getReturnedClassName, getSqlTypeCodes, getTypeForEqualsHashCode, isAnyType, isAssociationType, isCollectionType, isComponentType, isDirty, isDirty, isEntityType, isEqual, isEqual, isModified, isMutable, isSame, nullSafeSet, nullSafeSet, replace, replace, toColumnNullness, toLoggableString
-
-
-
-
Method Detail
-
getSubtypes
Type[] getSubtypes()
Get the types of the component properties- Returns:
- The component property types.
-
getPropertyNames
String[] getPropertyNames()
Get the names of the component properties- Returns:
- The component property names
-
getPropertyNullability
boolean[] getPropertyNullability()
Retrieve the indicators regarding which component properties are nullable.An optional operation
- Returns:
- nullability of component properties
-
getPropertyValues
Object[] getPropertyValues(Object component, SharedSessionContractImplementor session) throws HibernateException
Extract the values of the component properties from the given component instance- Parameters:
component
- The component instancesession
- The session from which the request originates- Returns:
- The property values
- Throws:
HibernateException
- Indicates a problem access the property values.
-
getPropertyValues
Object[] getPropertyValues(Object component) throws HibernateException
Extract the values of the component properties from the given component instance without access to the session.An optional operation
- Parameters:
component
- The component instance- Returns:
- The property values
- Throws:
HibernateException
- Indicates a problem access the property values.
-
getPropertyValue
Object getPropertyValue(Object component, int index, SharedSessionContractImplementor session) throws HibernateException
Extract a particular component property value indicated by index.- Parameters:
component
- The component instanceindex
- The index of the property whose value is to be extractedsession
- The session from which the request originates.- Returns:
- The extracted component property value
- Throws:
HibernateException
- Indicates a problem access the property value.
-
setPropertyValues
void setPropertyValues(Object component, Object[] values) throws HibernateException
Inject property values onto the given component instanceAn optional operation
- Parameters:
component
- The component instancevalues
- The values to inject- Throws:
HibernateException
- Indicates an issue performing the injection
-
replacePropertyValues
default Object replacePropertyValues(Object component, Object[] values, SharedSessionContractImplementor session) throws HibernateException
Inject property values onto the given component instance, or return a new instance with the given property values.- Parameters:
component
- The component instancevalues
- The values to inject- Returns:
- A new instance as necessary
- Throws:
HibernateException
- Indicates an issue performing the injection- Since:
- 6.3
-
getCascadeStyle
CascadeStyle getCascadeStyle(int index)
Retrieve the cascade style of the indicated component property.- Parameters:
index
- The property index,- Returns:
- The cascade style.
-
getFetchMode
FetchMode getFetchMode(int index)
Retrieve the fetch mode of the indicated component property.- Parameters:
index
- The property index,- Returns:
- The fetch mode
-
isMethodOf
boolean isMethodOf(Method method)
Is the given method a member of this component's class?- Parameters:
method
- The method to check- Returns:
- True if the method is a member; false otherwise.
-
isEmbedded
boolean isEmbedded()
Is this component embedded? "embedded" indicates that the component is "virtual", that its properties are "flattened" onto its owner- Returns:
- True if this component is embedded; false otherwise.
-
hasNotNullProperty
boolean hasNotNullProperty()
Convenience method to quickly checkgetPropertyNullability()
for any non-nullable sub-properties.- Returns:
true
if any of the properties are not-nullable as indicated bygetPropertyNullability()
,false
otherwise.
-
hasNullProperty
default boolean hasNullProperty()
Convenience method to quickly check ifgetPropertyNullability()
contains a nullable sub-properties.- Returns:
true
if any of the properties are nullable as indicated bygetPropertyNullability()
,false
otherwise.
-
getPropertyIndex
int getPropertyIndex(String propertyName)
Convenience method for locating the property index for a given property name.- Parameters:
propertyName
- The (sub-)property name to find.- Returns:
- The (sub-)property index, relative to all the array-valued method returns defined on this contract.
-
-