public static List < Instance > findAllScopedInstances ( AbstractApplication app ) { List < Instance > instanceList = new ArrayList <> ( ) ; List < Instance > todo = new ArrayList <> ( ) ; todo . addAll ( app . getRootInstances ( ) ) ; while ( ! todo . isEmpty ( ) ) { Instance current = todo . remove ( 0 ) ; todo . addAll ( current . getChildren ( ) ) ; if ( isTarget ( current ) ) instanceList . add ( current ) ; } return instanceList ; }
Finds all the scoped instances from an application .