JavaMetamodel.getManager().getResource(FileObject fo);

This method will get you to the resource. See How do I get a JavaClass from a Resource to find out how to get a JavaClass from that.

Source: NetBeans FAQ