Set<Class> validSet = new HashSet<Class>(Arrays.asList(validClasses));
ValidSet validSet = new ValidSet( validClasses );
    public Object invoke(MethodInvocation mi) throws Throwable    {        /* find concrete method */        Method mthd = mi.getMethod();        Class implClass = mi.getThis().getClass();        Method implMethod = implClass.getMethod(mthd.getName(), (Class[]) mthd                .getParameterTypes());        log.info("Checking: " + implMethod);        /* get arrays of arguments with parameters */        Object[] args = mi.getArguments() == null ? new Object[]{} : mi.getArguments();        Annotation[][] anns = implMethod.getParameterAnnotations();        for (int i = 0; i < args.length; i++)        {            Object arg = args[i];            Annotation[] annotations = anns[i];            boolean validated = false;            for (Annotation annotation : annotations)            {                if (NotNull.class.equals(annotation.annotationType()))                {                    if (null == arg)                    {                        String msg = "Argument " + i + " to " + implMethod                                + " may not be null.";                        log.warn(msg);                        throw new IllegalArgumentException(msg);                    }                }                else if (Validate.class.equals(annotation.annotationType()))                {                    validated = true;                    Validate validator = (Validate) annotation;                    Class[] validClasses = validator.value();                    Set<Class> validSet = new HashSet<Class>(Arrays.asList(validClasses));                    String msg = "Argument " + i + " must be of a type in:"                            + validSet;                    if (null == arg) {                        // handled by NotNull                    }                                        else if (arg instanceof Collection)                    {                        Collection coll = (Collection) arg;                        for (Object object : coll)                        {                            if (!validSet.contains(object.getClass()))                                throw new IllegalArgumentException(msg);                        }                    }                    else                    {                        if (!validSet.contains(arg.getClass()))                        {                            throw new IllegalArgumentException(msg);                        }                    }                }            }            /* warn if someone's forgotten to annotate a method */            if (arg instanceof Collection && !validated)                throw new RootException("Internal server error: " + implMethod                        + " is missing a required @" + Validate.class.getName()                        + " annotation. Refusing to proceed...");        }        return mi.proceed();    }