Package org.hibernate.cfg
Class AnnotationBinder
- java.lang.Object
-
- org.hibernate.cfg.AnnotationBinder
-
public final class AnnotationBinder extends java.lang.ObjectJSR 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 theorg.hibernate.mappingpackage) 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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidbindClass(org.hibernate.annotations.common.reflection.XClass clazzToProcess, java.util.Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass, MetadataBuildingContext context)Bind a class having JSR175 annotations.static voidbindDefaults(MetadataBuildingContext context)static voidbindFetchProfilesForClass(org.hibernate.annotations.common.reflection.XClass clazzToProcess, MetadataBuildingContext context)static voidbindFetchProfilesForPackage(ClassLoaderService cls, java.lang.String packageName, MetadataBuildingContext context)static voidbindForeignKeyNameAndDefinition(SimpleValue value, org.hibernate.annotations.common.reflection.XProperty property, ForeignKey fkOverride, JoinColumn joinColumn, JoinColumns joinColumns, MetadataBuildingContext context)static voidbindPackage(ClassLoaderService cls, java.lang.String packageName, MetadataBuildingContext context)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.static ComponentcreateComponent(PropertyHolder propertyHolder, PropertyData inferredData, boolean isComponentEmbedded, boolean isIdentifierMapper, MetadataBuildingContext context)protected static voiddefineFetchingStrategy(ToOne toOne, org.hibernate.annotations.common.reflection.XProperty property)static ComponentfillComponent(PropertyHolder propertyHolder, PropertyData inferredData, AccessType propertyAccessor, boolean isNullable, EntityBinder entityBinder, boolean isComponentEmbedded, boolean isIdentifierMapper, boolean inSecondPass, MetadataBuildingContext buildingContext, java.util.Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)static ComponentfillComponent(PropertyHolder propertyHolder, PropertyData inferredData, PropertyData baseInferredData, AccessType propertyAccessor, boolean isNullable, EntityBinder entityBinder, boolean isComponentEmbedded, boolean isIdentifierMapper, boolean inSecondPass, MetadataBuildingContext buildingContext, java.util.Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)static java.lang.StringgeneratorType(GeneratedValue generatedValueAnn, MetadataBuildingContext buildingContext, org.hibernate.annotations.common.reflection.XClass javaTypeXClass)static FetchModegetFetchMode(FetchType fetch)static booleanisDefault(org.hibernate.annotations.common.reflection.XClass clazz, MetadataBuildingContext context)
-
-
-
Method Detail
-
bindDefaults
public static void bindDefaults(MetadataBuildingContext context)
-
bindPackage
public static void bindPackage(ClassLoaderService cls, java.lang.String packageName, MetadataBuildingContext context)
-
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 MappingExceptionBind a class having JSR175 annotations. Subclasses have to be bound after its parent class.- Parameters:
clazzToProcess- entity to bind asXClassinstanceinheritanceStatePerClass- 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)
-
bindFetchProfilesForPackage
public static void bindFetchProfilesForPackage(ClassLoaderService cls, java.lang.String packageName, MetadataBuildingContext context)
-
generatorType
public static java.lang.String generatorType(GeneratedValue generatedValueAnn, MetadataBuildingContext buildingContext, org.hibernate.annotations.common.reflection.XClass javaTypeXClass)
-
fillComponent
public static Component fillComponent(PropertyHolder propertyHolder, PropertyData inferredData, AccessType propertyAccessor, boolean isNullable, EntityBinder entityBinder, boolean isComponentEmbedded, boolean isIdentifierMapper, boolean inSecondPass, MetadataBuildingContext buildingContext, java.util.Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)
-
fillComponent
public static Component fillComponent(PropertyHolder propertyHolder, PropertyData inferredData, PropertyData baseInferredData, AccessType propertyAccessor, boolean isNullable, EntityBinder entityBinder, boolean isComponentEmbedded, boolean isIdentifierMapper, boolean inSecondPass, MetadataBuildingContext buildingContext, java.util.Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)
-
createComponent
public static Component createComponent(PropertyHolder propertyHolder, PropertyData inferredData, boolean isComponentEmbedded, boolean isIdentifierMapper, MetadataBuildingContext context)
-
defineFetchingStrategy
protected static void defineFetchingStrategy(ToOne toOne, org.hibernate.annotations.common.reflection.XProperty property)
-
bindForeignKeyNameAndDefinition
public static void bindForeignKeyNameAndDefinition(SimpleValue value, org.hibernate.annotations.common.reflection.XProperty property, ForeignKey fkOverride, JoinColumn joinColumn, JoinColumns joinColumns, MetadataBuildingContext context)
-
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 theirXClass.
-
-