private Set<ObjectInstance> objectInstancesFromFilteredNamedObjects(Set<NamedObject> list,QueryExp query){
  Set<ObjectInstance> result=new HashSet<ObjectInstance>();
  if (query == null) {
    for (    NamedObject no : list) {
      final DynamicMBean obj=no.getObject();
      final String className=safeGetClassName(obj);
      result.add(new ObjectInstance(no.getName(),className));
    }
  }
 else {
    MBeanServer oldServer=QueryEval.getMBeanServer();
    query.setMBeanServer(server);
    try {
      for (      NamedObject no : list) {
        final DynamicMBean obj=no.getObject();
        boolean res;
        try {
          res=query.apply(no.getName());
        }
 catch (        Exception e) {
          res=false;
        }
        if (res) {
          String className=safeGetClassName(obj);
          result.add(new ObjectInstance(no.getName(),className));
        }
      }
    }
  finally {
      query.setMBeanServer(oldServer);
    }
  }
  return result;
}

private Set < ObjectInstance > objectInstancesFromFilteredNamedObjects ( Set < NamedObject > list , QueryExp query ) { Set < ObjectInstance > result = new HashSet < ObjectInstance > ( ) ; if ( query == null ) { for ( NamedObject no : list ) { final DynamicMBean obj = no . getObject ( ) ; final String className = safeGetClassName ( obj ) ; result . add ( new ObjectInstance ( no . getName ( ) , className ) ) ; } } else { MBeanServer oldServer = QueryEval . getMBeanServer ( ) ; query . setMBeanServer ( server ) ; try { for ( NamedObject no : list ) { final DynamicMBean obj = no . getObject ( ) ; boolean res ; try { res = query . apply ( no . getName ( ) ) ; } catch ( Exception e ) { res = false ; } if ( res ) { String className = safeGetClassName ( obj ) ; result . add ( new ObjectInstance ( no . getName ( ) , className ) ) ; } } } finally { query . setMBeanServer ( oldServer ) ; } } return result ; }
applies the specified queries to the set of namedobjects .
