private void checkUriParameters(String key, Node node, List<String> templates) {
   Node parametersNode = NodeSelector.selectFrom(key, node);
   if (parametersNode != null) {
     for (Node child : parametersNode.getChildren()) {
       String parameterName = ((SimpleTypeNode) ((KeyValueNode) child).getKey()).getLiteralValue();
       if (!templates.contains(parameterName)) {
         child.annotate(
             new WarningMessageAnnotation("Unused uri parameter '" + parameterName + "'"));
       }
     }
   }
 }
Пример #2
0
 private static String dumpNode(Node child) {
   if (child instanceof KeyValueNode) {
     KeyValueNode keyValueNode = (KeyValueNode) child;
     return dumpNode(keyValueNode.getKey()) + " : " + dumpNode(keyValueNode.getValue());
   } else if (child instanceof ObjectNode) {
     return dump(child);
   } else if (child instanceof StringNode) {
     return "\"" + ((StringNode) child).getValue() + "\"";
   } else {
     return child.toString();
   }
 }
 @Override
 public boolean matches(@Nonnull Node node) {
   return node.getChildren().size() <= maxProperties;
 }
Пример #4
0
 public static String dump(Node node) {
   StringBuilder builder = new StringBuilder();
   List<String> children = dumpChildren(node.getChildren());
   builder.append("{").append(StringUtils.join(children, ",\n")).append("}");
   return builder.toString();
 }