use of org.hibernate.annotations.AnyKeyJavaClass in project hibernate-orm by hibernate.
the class BasicValueBinder method prepareAnyKey.
private void prepareAnyKey(XProperty modelXProperty) {
implicitJavaTypeAccess = (typeConfiguration) -> null;
explicitJavaTypeAccess = (typeConfiguration) -> {
final AnyKeyJavaType javaTypeAnn = findAnnotation(modelXProperty, AnyKeyJavaType.class);
if (javaTypeAnn != null) {
final Class<? extends BasicJavaType<?>> javaType = normalizeJavaType(javaTypeAnn.value());
if (javaType != null) {
return getManagedBeanRegistry().getBean(javaType).getBeanInstance();
}
}
final AnyKeyJavaClass javaClassAnn = findAnnotation(modelXProperty, AnyKeyJavaClass.class);
if (javaClassAnn != null) {
// noinspection rawtypes
return (BasicJavaType) typeConfiguration.getJavaTypeRegistry().getDescriptor(javaClassAnn.value());
}
return null;
};
explicitJdbcTypeAccess = (typeConfiguration) -> {
final AnyKeyJdbcType jdbcTypeAnn = findAnnotation(modelXProperty, AnyKeyJdbcType.class);
if (jdbcTypeAnn != null) {
final Class<? extends JdbcType> jdbcType = normalizeJdbcType(jdbcTypeAnn.value());
if (jdbcType != null) {
final ManagedBean<? extends JdbcType> jtdBean = getManagedBeanRegistry().getBean(jdbcType);
return jtdBean.getBeanInstance();
}
}
final AnyKeyJdbcTypeCode jdbcTypeCodeAnn = findAnnotation(modelXProperty, AnyKeyJdbcTypeCode.class);
if (jdbcTypeCodeAnn != null) {
if (jdbcTypeCodeAnn.value() != Integer.MIN_VALUE) {
return typeConfiguration.getJdbcTypeRegistry().getDescriptor(jdbcTypeCodeAnn.value());
}
}
return null;
};
}
Aggregations