/** * Creates two big maps that associate names to their entities. * * @param anchor a scope to start scanning from */ private void collectEntitiesByName(Scope<? extends Entity> anchor) { // Go through the aggregates for (ContainedConnection<? extends Entity, Aggregate> connection : anchor.getAggregates()) { collectContained(connection); // - descend Aggregate aggregate = connection.getContained(); collectEntitiesByName(aggregate.getScope()); } // Go through aliases for (ContainedConnection<? extends Entity, Alias> connection : anchor.getAliass()) { collectContained(connection); } // Go through enumerated types for (ContainedConnection<? extends Entity, sourceanalysis.Enum> connection : anchor.getEnums()) { collectContained(connection); } // Even go through constant data members for (ContainedConnection<? extends Entity, Field> connection : anchor.getFields()) { Field field = connection.getContained(); try { Type type = field.getType(); if (type.isFlat() && type.isConst() && type.getBaseType() instanceof Primitive) collectContained(connection); } catch (MissingInformationException e) { // Fields with no type are ignored } } // Look in inner namespace scopes for (ContainedConnection<? extends Entity, Namespace> connection : anchor.getNamespaces()) { // - descend Namespace namespace = connection.getContained(); collectEntitiesByName(namespace.getScope()); } }