コード例 #1
0
ファイル: RepositoryFeatures.java プロジェクト: samukanm/yawp
 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());
     }
   }
 }
コード例 #2
0
ファイル: RepositoryFeatures.java プロジェクト: samukanm/yawp
 public boolean hasCustomAction(Class<?> clazz, ActionKey actionKey) {
   EndpointFeatures<?> endpointFeatures = get(clazz);
   return endpointFeatures.hasCustomAction(actionKey);
 }
コード例 #3
0
ファイル: RepositoryFeatures.java プロジェクト: samukanm/yawp
 public boolean hasCustomAction(String endpointPath, ActionKey actionKey) {
   EndpointFeatures<?> endpointFeatures = get(endpointPath);
   return endpointFeatures.hasCustomAction(actionKey);
 }