Open beoliver opened 6 years ago
Two obvious solutions.
by name
is linear wrt the number of component types - it will always have to iterate over the whole collection.typeId
as the values. Lookup has hashmap performance.In any case a lookup by name can not and should not return a single entity as there is no guarantee. Option 2 makes more sense to me (if we want to do any kind of find by name)
https://github.com/ardoq/ardoq-java-client/blob/04a9dc8d5869dffe1aa05b7cddb52d68f9a3e08b/src/main/java/com/ardoq/adapter/ModelAdapter.java#L31
It is possible to create multiple componentTypes with the same name. The deserialisation into the internal Model object uses a map indexed by the
name
attribute. This leads to loss of information as duplicate names overwrite each-other. https://github.com/ardoq/ardoq-java-client/blob/04a9dc8d5869dffe1aa05b7cddb52d68f9a3e08b/src/main/java/com/ardoq/adapter/ModelAdapter.java#L35front end doesn't allow the user to create two references with the same name (will see if the java client allows you to create them)