/** * Returns whether the current node has child nodes. * * @return */ public boolean hasChildren() { return node.getChildCount() != 0; }
@Override public boolean hasNext() { return index < node.getChildCount(); }
private static void printAST(PrintStream out, SpelNode t, String indent) { if (t != null) { StringBuilder sb = new StringBuilder(); sb.append(indent).append(t.getClass().getSimpleName()); sb.append(" value:").append(t.toStringAST()); sb.append(t.getChildCount() < 2 ? "" : " #children:" + t.getChildCount()); out.println(sb.toString()); for (int i = 0; i < t.getChildCount(); i++) { printAST(out, t.getChild(i), indent + " "); } } }
private Operator findOperator(SpelNode node) { if (node instanceof Operator) { return (Operator) node; } int childCount = node.getChildCount(); for (int i = 0; i < childCount; i++) { Operator possible = findOperator(node.getChild(i)); if (possible != null) { return possible; } } return null; }
/** * Returns whether the current node has child nodes. * * @return */ public boolean hasChildren() { return node.getChildCount() != 0; }
@Override public boolean hasNext() { return index < node.getChildCount(); }
private List<String> findPermissions(SpelNode node) { List<String> list = new ArrayList<>(node.getChildCount()); if (startsWithIgnoreCase(node.toStringAST(), "hasRole") || startsWithIgnoreCase(node.toStringAST(), "hasAnyRole")) { for (int i = 0; i < node.getChildCount(); ++i) { list.add(remove(node.getChild(i).toStringAST(), '\'')); } } else { for (int i = 0; i < node.getChildCount(); ++i) { list.addAll(findPermissions(node.getChild(i))); } } LOGGER.debug("Found permissions: {}", list); return list; }