public DynamicMapInstantiator(EntityBinding mappingInfo) { this.entityName = mappingInfo.getEntity().getName(); isInstanceEntityNames.add(entityName); for (EntityBinding subEntityBinding : mappingInfo.getPostOrderSubEntityBindingClosure()) { isInstanceEntityNames.add(subEntityBinding.getEntity().getName()); } }
/** * Returns sub-EntityBinding objects in a special 'order', most derived subclasses first. * Specifically, the sub-entity bindings follow a depth-first, post-order traversal * * <p>Note that the returned value excludes this entity binding. * * @return sub-entity bindings ordered by those entity bindings that are most derived. */ public EntityBinding[] getPostOrderSubEntityBindingClosure() { EntityBinding[] results = new EntityBinding[0]; if (subEntityBindings.isEmpty()) { return results; } for (EntityBinding subEntityBinding : subEntityBindings) { EntityBinding[] subSubEntityBindings = subEntityBinding.getPostOrderSubEntityBindingClosure(); results = ArrayHelper.join(results, subSubEntityBindings); } if (!subEntityBindings.isEmpty()) { results = ArrayHelper.join( results, subEntityBindings.toArray(new EntityBinding[subEntityBindings.size()])); } return results; }