Class AnnotationBinder


  • public final class AnnotationBinder
    extends Object
    JSR 175 annotation binder which reads the annotations from classes, applies the principles of the EJB3 spec and produces the Hibernate configuration-time metamodel (the classes in the org.hibernate.mapping package)

    Some design description I tried to remove any link to annotation except from the 2 first level of method call. It'll enable to: - facilitate annotation overriding - mutualize one day xml and annotation binder (probably a dream though) - split this huge class in smaller mapping oriented classes bindSomething usually create the mapping container and is accessed by one of the 2 first level method makeSomething usually create the mapping container and is accessed by bindSomething[else] fillSomething take the container into parameter and fill it.

    • Method Detail

      • bindClass

        public static void bindClass​(org.hibernate.annotations.common.reflection.XClass clazzToProcess,
                                     Map<org.hibernate.annotations.common.reflection.XClass,​InheritanceState> inheritanceStatePerClass,
                                     MetadataBuildingContext context)
                              throws MappingException
        Bind a class having JSR175 annotations. Subclasses have to be bound after its parent class.
        Parameters:
        clazzToProcess - entity to bind as XClass instance
        inheritanceStatePerClass - Meta data about the inheritance relationships for all mapped classes
        Throws:
        MappingException - in case there is a configuration error
      • getOverridableAnnotation

        public static <T extends Annotation> T getOverridableAnnotation​(org.hibernate.annotations.common.reflection.XAnnotatedElement element,
                                                                        Class<T> annotationType,
                                                                        MetadataBuildingContext context)
      • bindFetchProfilesForClass

        public static void bindFetchProfilesForClass​(org.hibernate.annotations.common.reflection.XClass clazzToProcess,
                                                     MetadataBuildingContext context)
      • resolveTimeZoneStorageCompositeUserType

        protected static Class<? extends CompositeUserType<?>> resolveTimeZoneStorageCompositeUserType​(org.hibernate.annotations.common.reflection.XProperty property,
                                                                                                       org.hibernate.annotations.common.reflection.XClass returnedClass,
                                                                                                       MetadataBuildingContext context)
      • generatorType

        public static String generatorType​(jakarta.persistence.GeneratedValue generatedValueAnn,
                                           MetadataBuildingContext buildingContext,
                                           org.hibernate.annotations.common.reflection.XClass javaTypeXClass)
      • getFetchMode

        public static FetchMode getFetchMode​(jakarta.persistence.FetchType fetch)
      • bindForeignKeyNameAndDefinition

        public static void bindForeignKeyNameAndDefinition​(SimpleValue value,
                                                           org.hibernate.annotations.common.reflection.XProperty property,
                                                           jakarta.persistence.ForeignKey fkOverride,
                                                           jakarta.persistence.JoinColumn joinColumn,
                                                           jakarta.persistence.JoinColumns joinColumns,
                                                           MetadataBuildingContext context)
      • isDefault

        public static boolean isDefault​(org.hibernate.annotations.common.reflection.XClass clazz,
                                        MetadataBuildingContext context)
      • buildInheritanceStates

        public static Map<org.hibernate.annotations.common.reflection.XClass,​InheritanceState> buildInheritanceStates​(List<org.hibernate.annotations.common.reflection.XClass> orderedClasses,
                                                                                                                            MetadataBuildingContext buildingContext)
        For the mapped entities build some temporary data-structure containing information about the inheritance status of a class.
        Parameters:
        orderedClasses - Order list of all annotated entities and their mapped superclasses
        Returns:
        A map of InheritanceStates keyed against their XClass.