System.out.println("Trying to find setPassword(String) method");
System.out.println( "Trying to find setPassword(String) method on: " + object.getClass().getName());
    public void invokeContactManager(String forOwner, String username,        String password, int nrOfCalls) {        StopWatch stopWatch = new StopWatch(nrOfCalls                + " ContactManager call(s)");        Map orderServices = this.beanFactory.getBeansOfType(ContactManager.class,                true, true);        for (Iterator it = orderServices.keySet().iterator(); it.hasNext();) {            String beanName = (String) it.next();            ContactManager remoteContactManager = (ContactManager) orderServices                .get(beanName);            System.out.println("Calling ContactManager '" + beanName                + "' for owner " + forOwner);            Object object = this.beanFactory.getBean("&" + beanName);            try {                System.out.println("Trying to find setUsername(String) method");                Method method = object.getClass().getMethod("setUsername",                        new Class[] {String.class});                System.out.println("Found; Trying to setUsername(String) to "                    + username);                method.invoke(object, new Object[] {username});            } catch (NoSuchMethodException ignored) {                ignored.printStackTrace();            } catch (IllegalAccessException ignored) {                ignored.printStackTrace();            } catch (InvocationTargetException ignored) {                ignored.printStackTrace();            }            try {                System.out.println("Trying to find setPassword(String) method");                Method method = object.getClass().getMethod("setPassword",                        new Class[] {String.class});                method.invoke(object, new Object[] {password});                System.out.println("Found; Trying to setPassword(String) to "                    + password);            } catch (NoSuchMethodException ignored) {}            catch (IllegalAccessException ignored) {}            catch (InvocationTargetException ignored) {}            stopWatch.start(beanName);            List contacts = null;            for (int i = 0; i < nrOfCalls; i++) {                contacts = remoteContactManager.getAll();            }            stopWatch.stop();            if (contacts.size() == 0) {                Iterator listIterator = contacts.iterator();                while (listIterator.hasNext()) {                    Contact contact = (Contact) listIterator.next();                    System.out.println("Contact: " + contact.toString());                }            } else {                System.out.println(                    "No contacts found which this user has permission to");            }            System.out.println();            System.out.println(stopWatch.prettyPrint());        }    }