if (entityClasses != null && entityClasses.size() > 0) {
// scan thru list building details of persistent classes
for (MetadataClass metaClass : entityClasses) {
// check to ensure that class is present in project
// this will be a relational descriptor because MetadataClass only describes relational descriptors
RelationalDescriptor descriptor = (RelationalDescriptor)findDescriptor(session.getProject(), metaClass.getName());
if (descriptor == null) {
log(SessionLog.FINER, WEAVER_CLASS_NOT_IN_PROJECT, new Object[]{metaClass.getName()});
} else {
log(SessionLog.FINER, WEAVER_PROCESSING_CLASS, new Object[]{metaClass.getName()});
boolean weaveValueHoldersForClass = weaveLazy && canWeaveValueHolders(metaClass, descriptor.getMappings());
boolean weaveChangeTrackingForClass = canChangeTrackingBeEnabled(descriptor, metaClass, weaveChangeTracking);
ClassDetails classDetails = createClassDetails(metaClass, weaveValueHoldersForClass, weaveChangeTrackingForClass, weaveFetchGroups, weaveInternal);
if (descriptor.isDescriptorTypeAggregate()) {
classDetails.setIsEmbedable(true);
classDetails.setShouldWeaveFetchGroups(false);
}
if (!descriptor.usesPropertyAccessForWeaving()){
classDetails.useAttributeAccess();
}
classDetails.getVirtualAccessMethods().addAll(descriptor.getVirtualAttributeMethods());
List unMappedAttributes = storeAttributeMappings(metaClass, classDetails, descriptor.getMappings(), weaveValueHoldersForClass);
classDetailsMap.put(classDetails.getClassName() ,classDetails);
classDetails.setShouldWeaveConstructorOptimization((classDetails.getDescribedClass().getFields().size() - (descriptor.getMappings().size() - unMappedAttributes.size()))<=0);
if (!unMappedAttributes.isEmpty()){
addClassDetailsForMappedSuperClasses(metaClass, descriptor, classDetails, classDetailsMap, unMappedAttributes, weaveChangeTracking);
}
if (classDetails.getLazyMappings() != null){
Iterator iterator = classDetails.getLazyMappings().iterator();
while (iterator.hasNext()) {
ForeignReferenceMapping mapping = (ForeignReferenceMapping)iterator.next();
mapping.setGetMethodName(ClassWeaver.getWeavedValueHolderGetMethodName(mapping.getAttributeName()));
mapping.setSetMethodName(ClassWeaver.getWeavedValueHolderSetMethodName(mapping.getAttributeName()));
}
}
}
}
// hookup superClassDetails
for (Iterator i = classDetailsMap.values().iterator(); i.hasNext();) {
ClassDetails classDetails = (ClassDetails)i.next();
ClassDetails superClassDetails = classDetailsMap.get(classDetails.getSuperClassName());
if (superClassDetails == null) {
ClassDescriptor descriptor = findDescriptor(session.getProject(), classDetails.getClassName());
if (descriptor != null && descriptor.hasInheritance()){
superClassDetails = classDetailsMap.get(descriptor.getInheritancePolicy().getParentClassName());
}
}
if (superClassDetails != null) {
classDetails.setSuperClassDetails(superClassDetails);
}