namespace = new MetaNamespace(namespaceName);
namespacesMap.put(namespaceName, namespace);
}
String kindName = kindEntity.getKey().getName();
namespace.getKindsMap().put(kindName, new MetaKind(kindName));
}
}
// step 2 : populate properties map
for (String namespaceName : propertiesMap.keySet()) {
for (Entity propertyEntity : propertiesMap.get(namespaceName)) {
Key propertyKey = propertyEntity.getKey();
Key kindKey = propertyKey.getParent();
@SuppressWarnings("unchecked")
List<String> representation =
(List<String>) propertyEntity.getProperty(PROPERTY_REPRESENTATION);
MetaNamespace namespace = namespacesMap.get(namespaceName);
if (namespace == null) {
throw new IllegalArgumentException("unknown namespace " + namespaceName);
}
MetaKind kind = namespace.getKindsMap().get(kindKey.getName());
if (kind == null) {
throw new IllegalArgumentException("unknown kind " + kindKey.getName());
}
kind.addProperty(propertyKey.getName(), representation);
}
}
return new ArrayList<MetaNamespace>(namespacesMap.values());
}