private void add(int id, Class<? extends Identifiable> spec, Supplier<? extends Identifiable> construct) {
            Class<?> old = get(id);
            if (old == null) {
                typeMap.put(id, new Pair<Class<? extends Identifiable>, Supplier<? extends Identifiable>>(spec, construct));
            } else if (!spec.equals(old)) {
                throw new IllegalArgumentException("Can not register class '" + spec + "' with id " + id +
                        ", because it already maps to class '" + old + "'.");
            }
        }
Adds an entry in the type map, pairing the given identifier with the given class specification.

@param id   The class identifier to register with.
@param spec The class to register.
@throws IllegalArgumentException Thrown if two classes attempt to register with the same identifier.
vespajlib/src/main/java/com/yahoo/vespa/objects/Identifiable.java