public RepositoryFeatures(Collection<EndpointFeatures<?>> endpoints) { this.endpoints = new HashMap<>(); this.paths = new HashMap<>(); for (EndpointFeatures<?> endpoint : endpoints) { this.endpoints.put(endpoint.getClazz(), endpoint); String endpointPath = endpoint.getEndpointPath(); if (!endpointPath.isEmpty()) { if (paths.get(endpointPath) != null) { throw new RuntimeException( "Repeated io.yawp path " + endpointPath + " for class " + endpoint.getClazz().getSimpleName() + " (already found in class " + paths.get(endpointPath).getSimpleName() + ")"); } if (!isValidEndpointPath(endpointPath)) { throw new RuntimeException( "Invalid io.yawp path " + endpointPath + " for class " + endpoint.getClazz().getSimpleName()); } paths.put(endpointPath, endpoint.getClazz()); } } }