@Override public void bindMappingMetadata(MetadataSources sources, List<String> processedEntityNames) { AnnotationBindingContext context = new AnnotationBindingContext(index, metadata.getServiceRegistry()); // need to order our annotated entities into an order we can process Set<ConfiguredClassHierarchy<EntityClass>> hierarchies = ConfiguredClassHierarchyBuilder.createEntityHierarchies(context); // now we process each hierarchy one at the time Hierarchical parent = null; for (ConfiguredClassHierarchy<EntityClass> hierarchy : hierarchies) { for (EntityClass entityClass : hierarchy) { // for classes annotated w/ @Entity we create a EntityBinding if (ConfiguredClassType.ENTITY.equals(entityClass.getConfiguredClassType())) { LOG.bindingEntityFromAnnotatedClass(entityClass.getName()); EntityBinder entityBinder = new EntityBinder(metadata, entityClass, parent); EntityBinding binding = entityBinder.bind(); parent = binding.getEntity(); } // for classes annotated w/ @MappedSuperclass we just create the domain instance // the attribute bindings will be part of the first entity subclass else if (ConfiguredClassType.MAPPED_SUPERCLASS.equals( entityClass.getConfiguredClassType())) { parent = new Superclass(entityClass.getName(), parent); } // for classes which are not annotated at all we create the NonEntity domain class // todo - not sure whether this is needed. It might be that we don't need this information // (HF) else { parent = new NonEntity(entityClass.getName(), parent); } } } }
private ClassLoaderService classLoaderService() { if (classLoaderService == null) { classLoaderService = metadata.getServiceRegistry().getService(ClassLoaderService.class); } return classLoaderService; }