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()); } } }
public boolean hasCustomAction(Class<?> clazz, ActionKey actionKey) { EndpointFeatures<?> endpointFeatures = get(clazz); return endpointFeatures.hasCustomAction(actionKey); }
public boolean hasCustomAction(String endpointPath, ActionKey actionKey) { EndpointFeatures<?> endpointFeatures = get(endpointPath); return endpointFeatures.hasCustomAction(actionKey); }