Package org.hibernate.cfg
Class AnnotationBinder
- java.lang.Object
-
- org.hibernate.cfg.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 theorg.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
bindClass(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 void
bindDefaults(MetadataBuildingContext context)
static void
bindFetchProfilesForClass(org.hibernate.annotations.common.reflection.XClass clazzToProcess, MetadataBuildingContext context)
static void
bindFetchProfilesForPackage(ClassLoaderService cls, java.lang.String packageName, MetadataBuildingContext context)
static void
bindForeignKeyNameAndDefinition(SimpleValue value, org.hibernate.annotations.common.reflection.XProperty property, ForeignKey fkOverride, JoinColumn joinColumn, JoinColumns joinColumns, MetadataBuildingContext context)
static void
bindPackage(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 Component
createComponent(PropertyHolder propertyHolder, PropertyData inferredData, boolean isComponentEmbedded, boolean isIdentifierMapper, MetadataBuildingContext context)
protected static void
defineFetchingStrategy(ToOne toOne, org.hibernate.annotations.common.reflection.XProperty property)
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)
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)
static java.lang.String
generatorType(GeneratedValue generatedValueAnn, MetadataBuildingContext buildingContext, org.hibernate.annotations.common.reflection.XClass javaTypeXClass)
static FetchMode
getFetchMode(FetchType fetch)
static boolean
isDefault(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 MappingException
Bind a class having JSR175 annotations. Subclasses have to be bound after its parent class.- Parameters:
clazzToProcess
- entity to bind asXClass
instanceinheritanceStatePerClass
- 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
InheritanceState
s keyed against theirXClass
.
-
-