public List < AstNode > getChildrenForType ( AstNode astNode , String nodeType ) { CheckArg . isNotNull ( astNode , "astNode" ) ; CheckArg . isNotNull ( nodeType , "nodeType" ) ; List < AstNode > childrenOfType = new ArrayList < AstNode > ( ) ; for ( AstNode child : astNode . getChildren ( ) ) { if ( hasMixinType ( child , nodeType ) ) { childrenOfType . add ( child ) ; } List < AstNode > subChildrenOfType = getChildrenForType ( child , nodeType ) ; childrenOfType . addAll ( subChildrenOfType ) ; } return childrenOfType ; }
Utility method to obtain the children of a given node that match the given type