
import java.beans.*;
import java.lang.reflect.Method;
import java.net.URI;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.Map;
import java.util.TreeMap;


public class Test {

    public static void main(String[] args) throws Exception {

        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
        fs.getFileStores();

        TreeMap<String, BeanInfo> types = new TreeMap<>();

        Files.walkFileTree(fs.getPath("/modules/java.desktop"), new SimpleFileVisitor<Path>() {
            @Override
            public FileVisitResult visitFile(Path file,
                                             BasicFileAttributes attrs) {
                file = file.subpath(2, file.getNameCount());
                if (file.startsWith("java/awt/")
                        || file.startsWith("javax/accessibility/")
                        || file.startsWith("javax/swing/")) {
                    String name =file.toString();
                    if (name.endsWith(".class")) {
                        name = name.substring(0, name.indexOf(".")).replace('/', '.');

                        final Class<?> type;
                        try {
                            type = Class.forName(name);
                        } catch (ClassNotFoundException e) {
                            throw new RuntimeException(e);
                        }
                        if (!BeanInfo.class.isAssignableFrom(type) && !type.isInterface()
                            && !type.isEnum() && !type.isAnnotation()
                            && !type.isAnonymousClass()) {
                            if (null == type.getDeclaringClass()) {
                                try {
                                    types.put(type.getName(), Introspector.getBeanInfo(type));
                                } catch (IntrospectionException e) {
                                    throw new RuntimeException(e);
                                }
                            }
                        }
                    }
                }
                return FileVisitResult.CONTINUE;
            }
        });

        for (Map.Entry<String, BeanInfo> entry : types.entrySet()) {

            System.out.println("<<<" + entry.getKey() + ">>>");
            PropertyDescriptor[] pds = entry.getValue().getPropertyDescriptors();
            for (PropertyDescriptor pd : pds) {
                Method wm = pd.getWriteMethod();
                if (wm != null) { System.out.println("write method: " + wm); }
            }
        }
    }
}
