Search in sources :

Example 1 with CollectionTypeRegistrations

use of org.hibernate.annotations.CollectionTypeRegistrations in project hibernate-orm by hibernate.

the class AnnotationBinder method handleTypeDescriptorRegistrations.

private static void handleTypeDescriptorRegistrations(XAnnotatedElement annotatedElement, MetadataBuildingContext context) {
    final ManagedBeanRegistry managedBeanRegistry = context.getBootstrapContext().getServiceRegistry().getService(ManagedBeanRegistry.class);
    final JavaTypeRegistration javaTypeAnn = annotatedElement.getAnnotation(JavaTypeRegistration.class);
    if (javaTypeAnn != null) {
        handleJavaTypeRegistration(context, managedBeanRegistry, javaTypeAnn);
    } else {
        final JavaTypeRegistrations annotation = annotatedElement.getAnnotation(JavaTypeRegistrations.class);
        if (annotation != null) {
            final JavaTypeRegistration[] registrations = annotation.value();
            for (JavaTypeRegistration registration : registrations) {
                handleJavaTypeRegistration(context, managedBeanRegistry, registration);
            }
        }
    }
    final JdbcTypeRegistration jdbcTypeAnn = annotatedElement.getAnnotation(JdbcTypeRegistration.class);
    if (jdbcTypeAnn != null) {
        handleJdbcTypeRegistration(context, managedBeanRegistry, jdbcTypeAnn);
    } else {
        final JdbcTypeRegistrations jdbcTypesAnn = annotatedElement.getAnnotation(JdbcTypeRegistrations.class);
        if (jdbcTypesAnn != null) {
            final JdbcTypeRegistration[] registrations = jdbcTypesAnn.value();
            for (JdbcTypeRegistration registration : registrations) {
                handleJdbcTypeRegistration(context, managedBeanRegistry, registration);
            }
        }
    }
    final CollectionTypeRegistration singleRegistration = annotatedElement.getAnnotation(CollectionTypeRegistration.class);
    if (singleRegistration != null) {
        context.getMetadataCollector().addCollectionTypeRegistration(singleRegistration);
    }
    final CollectionTypeRegistrations multiRegistration = annotatedElement.getAnnotation(CollectionTypeRegistrations.class);
    if (multiRegistration != null) {
        for (CollectionTypeRegistration registration : multiRegistration.value()) {
            context.getMetadataCollector().addCollectionTypeRegistration(registration);
        }
    }
}
Also used : CollectionTypeRegistration(org.hibernate.annotations.CollectionTypeRegistration) JavaTypeRegistrations(org.hibernate.annotations.JavaTypeRegistrations) ManagedBeanRegistry(org.hibernate.resource.beans.spi.ManagedBeanRegistry) JdbcTypeRegistration(org.hibernate.annotations.JdbcTypeRegistration) JavaTypeRegistration(org.hibernate.annotations.JavaTypeRegistration) CollectionTypeRegistrations(org.hibernate.annotations.CollectionTypeRegistrations) JdbcTypeRegistrations(org.hibernate.annotations.JdbcTypeRegistrations)

Aggregations

CollectionTypeRegistration (org.hibernate.annotations.CollectionTypeRegistration)1 CollectionTypeRegistrations (org.hibernate.annotations.CollectionTypeRegistrations)1 JavaTypeRegistration (org.hibernate.annotations.JavaTypeRegistration)1 JavaTypeRegistrations (org.hibernate.annotations.JavaTypeRegistrations)1 JdbcTypeRegistration (org.hibernate.annotations.JdbcTypeRegistration)1 JdbcTypeRegistrations (org.hibernate.annotations.JdbcTypeRegistrations)1 ManagedBeanRegistry (org.hibernate.resource.beans.spi.ManagedBeanRegistry)1