Package org.hibernate.metamodel.mapping
Class DiscriminatorConverter<O,R>
- java.lang.Object
-
- org.hibernate.metamodel.mapping.DiscriminatorConverter<O,R>
-
- Type Parameters:
O
- The domain type - either- the entity Class for unnamed entities
- the entity name for named entities
R
- The Java type of the relational form of the discriminator
- All Implemented Interfaces:
BasicValueConverter<O,R>
public class DiscriminatorConverter<O,R> extends Object implements BasicValueConverter<O,R>
Conversion of discriminator values between the entity name/Class domain form and its generally CHARACTER or INTEGER based relational form
-
-
Constructor Summary
Constructors Constructor Description DiscriminatorConverter(NavigableRole discriminatorRole, JavaType<O> domainJavaType, JavaType<R> relationalJavaType, List<DiscriminatorValueDetails> valueMappings)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
forEachValueDetail(Consumer<DiscriminatorValueDetails> consumer)
<X> X
fromValueDetails(Function<DiscriminatorValueDetails,X> handler)
static <O,R>
DiscriminatorConverter<O,R>fromValueMappings(NavigableRole role, JavaType<O> domainJavaType, BasicType<R> underlyingJdbcMapping, Map<Object,String> valueMappings, SessionFactoryImplementor sessionFactory)
DiscriminatorValueDetails
getDetailsForDiscriminatorValue(Object value)
DiscriminatorValueDetails
getDetailsForEntityName(String entityName)
DiscriminatorValueDetails
getDetailsForRelationalForm(R relationalForm)
JavaType<O>
getDomainJavaType()
Descriptor for the Java type for the domain portion of this converterNavigableRole
getNavigableRole()
JavaType<R>
getRelationalJavaType()
Descriptor for the Java type for the relational portion of this converterO
toDomainValue(R relationalForm)
Convert the relational form just retrieved from JDBC ResultSet into the domain form.R
toRelationalValue(O domainForm)
Convert the domain form into the relational form in preparation for storage into JDBCString
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hibernate.type.descriptor.converter.spi.BasicValueConverter
getCheckCondition, getSpecializedTypeDeclaration
-
-
-
-
Constructor Detail
-
DiscriminatorConverter
public DiscriminatorConverter(NavigableRole discriminatorRole, JavaType<O> domainJavaType, JavaType<R> relationalJavaType, List<DiscriminatorValueDetails> valueMappings)
-
-
Method Detail
-
fromValueMappings
public static <O,R> DiscriminatorConverter<O,R> fromValueMappings(NavigableRole role, JavaType<O> domainJavaType, BasicType<R> underlyingJdbcMapping, Map<Object,String> valueMappings, SessionFactoryImplementor sessionFactory)
-
getNavigableRole
public NavigableRole getNavigableRole()
-
getDomainJavaType
public JavaType<O> getDomainJavaType()
Description copied from interface:BasicValueConverter
Descriptor for the Java type for the domain portion of this converter- Specified by:
getDomainJavaType
in interfaceBasicValueConverter<O,R>
-
getRelationalJavaType
public JavaType<R> getRelationalJavaType()
Description copied from interface:BasicValueConverter
Descriptor for the Java type for the relational portion of this converter- Specified by:
getRelationalJavaType
in interfaceBasicValueConverter<O,R>
-
getDetailsForRelationalForm
public DiscriminatorValueDetails getDetailsForRelationalForm(R relationalForm)
-
toDomainValue
public O toDomainValue(R relationalForm)
Description copied from interface:BasicValueConverter
Convert the relational form just retrieved from JDBC ResultSet into the domain form.- Specified by:
toDomainValue
in interfaceBasicValueConverter<O,R>
-
getDetailsForEntityName
public DiscriminatorValueDetails getDetailsForEntityName(String entityName)
-
getDetailsForDiscriminatorValue
public DiscriminatorValueDetails getDetailsForDiscriminatorValue(Object value)
-
toRelationalValue
public R toRelationalValue(O domainForm)
Description copied from interface:BasicValueConverter
Convert the domain form into the relational form in preparation for storage into JDBC- Specified by:
toRelationalValue
in interfaceBasicValueConverter<O,R>
-
forEachValueDetail
public void forEachValueDetail(Consumer<DiscriminatorValueDetails> consumer)
-
fromValueDetails
public <X> X fromValueDetails(Function<DiscriminatorValueDetails,X> handler)
-
-