void finishEntityObject(final DotName name, final EntityMappingsMocker.Default defaults) {
    Map<DotName, List<AnnotationInstance>> map = classInfoAnnotationsMap.get(name);
    if (map == null) {
      throw new AssertionFailure("Calling finish entity object " + name + " before create it.");
    }
    // annotations classes overrided by xml
    if (indexedClassInfoAnnotationsMap.containsKey(name)) {
      Map<DotName, List<AnnotationInstance>> tmp = getIndexedAnnotations(name);
      mergeAnnotationMap(tmp, map);
    }
    DefaultConfigurationHelper.INSTANCE.applyDefaults(map, defaults);

    mergeAnnotationMap(map, annotations);
  }
 /**
  * Build new {@link Index} with mocked annotations from orm.xml. This method should be only called
  * once per {@org.hibernate.metamodel.source.annotations.xml.mocker.IndexBuilder IndexBuilder}
  * instance.
  *
  * @param globalDefaults Global defaults from <persistence-unit-metadata>, or null.
  * @return Index.
  */
 Index build(EntityMappingsMocker.Default globalDefaults) {
   // merge annotations that not overrided by xml into the new Index
   for (ClassInfo ci : index.getKnownClasses()) {
     DotName name = ci.name();
     if (indexedClassInfoAnnotationsMap.containsKey(name)) {
       // this class has been overrided by orm.xml
       continue;
     }
     if (ci.annotations() != null && !ci.annotations().isEmpty()) {
       Map<DotName, List<AnnotationInstance>> tmp =
           new HashMap<DotName, List<AnnotationInstance>>(ci.annotations());
       DefaultConfigurationHelper.INSTANCE.applyDefaults(tmp, globalDefaults);
       mergeAnnotationMap(tmp, annotations);
       classes.put(name, ci);
       if (ci.superName() != null) {
         addSubClasses(ci.superName(), ci);
       }
       if (ci.interfaces() != null && ci.interfaces().length > 0) {
         addImplementors(ci.interfaces(), ci);
       }
     }
   }
   return Index.create(annotations, subclasses, implementors, classes);
 }