类 AnnotationBinder
- java.lang.Object
-
- org.hibernate.cfg.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 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.- 作者:
- Emmanuel Bernard, Hardy Ferentschik
-
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static voidbindClass(org.hibernate.annotations.common.reflection.XClass clazzToProcess, Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass, MetadataBuildingContext context)Bind a class having JSR175 annotations.static voidbindDefaults(MetadataBuildingContext context)static voidbindForeignKeyNameAndDefinition(SimpleValue value, org.hibernate.annotations.common.reflection.XProperty property, javax.persistence.ForeignKey fkOverride, javax.persistence.JoinColumn joinColumn, javax.persistence.JoinColumns joinColumns)static voidbindPackage(String packageName, MetadataBuildingContext context)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.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, 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, Map<org.hibernate.annotations.common.reflection.XClass,InheritanceState> inheritanceStatePerClass)static StringgeneratorType(javax.persistence.GeneratedValue generatedValueAnn, MetadataBuildingContext buildingContext, org.hibernate.annotations.common.reflection.XClass javaTypeXClass)static FetchModegetFetchMode(javax.persistence.FetchType fetch)static booleanisDefault(org.hibernate.annotations.common.reflection.XClass clazz, MetadataBuildingContext context)
-
-
-
方法详细资料
-
bindDefaults
public static void bindDefaults(MetadataBuildingContext context)
-
bindPackage
public static void bindPackage(String packageName, MetadataBuildingContext context)
-
bindClass
public static void bindClass(org.hibernate.annotations.common.reflection.XClass clazzToProcess, 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.- 参数:
clazzToProcess- entity to bind asXClassinstanceinheritanceStatePerClass- Meta data about the inheritance relationships for all mapped classes- 抛出:
MappingException- in case there is a configuration error
-
generatorType
public static String generatorType(javax.persistence.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, 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, 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)
-
getFetchMode
public static FetchMode getFetchMode(javax.persistence.FetchType fetch)
-
bindForeignKeyNameAndDefinition
public static void bindForeignKeyNameAndDefinition(SimpleValue value, org.hibernate.annotations.common.reflection.XProperty property, javax.persistence.ForeignKey fkOverride, javax.persistence.JoinColumn joinColumn, javax.persistence.JoinColumns joinColumns)
-
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.- 参数:
orderedClasses- Order list of all annotated entities and their mapped superclasses- 返回:
- A map of
InheritanceStates keyed against theirXClass.
-
-