private Collection < Resource > parseGroup ( final Element element ) { final String name = element . getAttribute ( ATTR_GROUP_NAME ) ; final String isAbstractAsString = element . getAttribute ( ATTR_GROUP_ABSTRACT ) ; final boolean isAbstractGroup = StringUtils . isNotEmpty ( isAbstractAsString ) && Boolean . valueOf ( isAbstractAsString ) ; if ( groupsInProcess . contains ( name ) ) { throw new RecursiveGroupDefinitionException ( "Infinite Recursion detected for the group: " + name + ". Recursion path: " + groupsInProcess ) ; } LOG . debug ( "\tadding group: {}" , name ) ; groupsInProcess . add ( name ) ; // skip if this group is already parsed final Group parsedGroup = new WroModelInspector ( model ) . getGroupByName ( name ) ; if ( parsedGroup != null ) { // remove before returning // this group is parsed, remove from unparsed groups collection groupsInProcess . remove ( name ) ; return parsedGroup . getResources ( ) ; } final Group group = createGroup ( element ) ; // this group is parsed, remove from unparsed collection groupsInProcess . remove ( name ) ; if ( ! isAbstractGroup ) { // add only non abstract groups model . addGroup ( group ) ; } return group . getResources ( ) ; }
Recursive method . Add the parsed element group to the group collection . If the group contains group - ref element parse recursively this group .