public int addPermissions(PermissionCollection collection, Class permClass) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
int addPermissions(PermissionCollection collection, Class permClass) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {
	public int addPermissions(PermissionCollection collection, Class permClass) throws SecurityException, NoSuchMethodException, IllegalArgumentException, InstantiationException, IllegalAccessException, InvocationTargetException {		String permClassName = permClass.getName();		Constructor constructor = permClass.getConstructor(twoStringClassArray);		int count = 0;		/*		 * TODO: We need to cache the constructed permissions to enhance		 * performance.		 */		for (int i = 0; i < perms.length; i++) {			if (perms[i].getType().equals(permClassName)) {				count++;				String args[] = new String[2];				args[0] = perms[i].getName();				args[1] = perms[i].getActions();				collection.add((Permission) constructor.newInstance(args));			}		}		return count;	}