Class AnnotationBinder


  • public final class AnnotationBinder
    extends java.lang.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,
                                     java.util.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
      • bindFetchProfilesForClass

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

        public static java.lang.String generatorType​(GeneratedValue generatedValueAnn,
                                                     MetadataBuildingContext buildingContext,
                                                     org.hibernate.annotations.common.reflection.XClass javaTypeXClass)
      • defineFetchingStrategy

        protected static void defineFetchingStrategy​(ToOne toOne,
                                                     org.hibernate.annotations.common.reflection.XProperty property)
      • isDefault

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

        public static java.util.Map<org.hibernate.annotations.common.reflection.XClass,​InheritanceState> buildInheritanceStates​(java.util.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.