What is it ?

Meta Pojos is an eclipse plugin hat allows you to browse your Java code.
The querying is done in Java, allowing you to use your favorite IDE for content assist. For example, to get all calls to all methods named getXXX in classes whose name contains DAO you can do this :

MetaPojos.getClasses("DAO").getMethods("get").getCallsTo().print();

The results appear in a special console that has hyperlinks to places in your code :

The above is the result from a query for methods in ArrayList containing add.

Open source

Meta Pojos is open source. You fill find the source code and instructions about how to install from source code on github : https://github.com/yannicklerestif/meta-pojos

Getting started

Requirements

Meta Pojos has the following requirements :

Download and install

In eclipse, click Help / Install new software..., Click Add..., and add the following update site :
http://yannicklerestif.com/meta-pojos/p2.
Follow the instructions, then restart eclipse.

Running the sample query

Click File / New / Other..., and choose to create a Meta Pojos project :

If Meta Pojos category is not displayed, it most probably means eclipse couldn't install it, and a probable cause for this is your eclipse JVM is not Java 8.

In the new window, choose a project name, for example meta-pojos-query, and click Finish.
Make sure you use a Java 8 JVM.

In the new project, navigate to the class src/query/MetaPojosQuery.java, and open it. Note the mp decorator, that indicates that the project is a Meta Pojos project :

Right click MetaPojosQuery.java, and choose Run As / Meta Pojos Query.

Meta Pojos reads the classes in your workspace, then executes the query, and displays the results in its console. The results have hyperlinks to places in your code.

Note that Meta Pojos will not read classes again until it has to, which means that if you want to execute another query, it will yield results instantly. Besides, once files are cached on your hard disk, loading can be significatively faster. All in all, for a 100,000 classes workspace, classes should usually be read in about 10 seconds.

The sample class

package query;

import com.yannicklerestif.metapojos.MetaPojos;

public class MetaPojosQuery {
    public static void main(String[] args) throws Exception {         
        MetaPojos.getClasses("java.util.ArrayList")
            .getMethods("add").print();                              //(1)
        MetaPojos.getConsole().println("----------------------");    //(2)   
        MetaPojos.getConsole().println("Classes analyzed : "  
            + MetaPojos.getClasses().stream().count());              //(3)
    }
}

A simple query (1)

Most things you will do with Meta Pojos start by calling a static method on the class com.yannicklerestif.metapojos.MetaPojos.

Here we use the method getClasses(String), that gets all the classes whose names contains the argument string.
The result is a com.yannicklerestif.metapojos.model.elements.streams.ClassStream object. This and the other Meta Pojos streams (now MethodStream and CallStream) are the next most important classes in Meta Pojos.

Here, we use the method getMethods(String), that returns all methods whose names contain the argument string.
The result is a MethodStream.

The last method we call is the method print(). It is available for all Meta Pojos streams, and outputs the result as a console hyperlink.
Actually, you could virtually have do anything with the result. But whatever you do, you must do it explicitly, so don't forget to call print() if that's what you want to do !

MetaPojos console (2)

You can have access to Meta Pojos console using MetaPojos.getConsole(). Feel free to log anything you want here. Just don't use System.out.println(), because this will write in eclipse' log, not in the console !
See below why Meta Pojos queries run in eclipse JVM.

Accessing the underlying stream (3)

On each Meta Pojos Java elements streams (ClassStream, MethodStream, CallStream), can can have access to the underlying Java 8 stream by calling the method stream(). Using this, you can do virtually anything with the results : filtering, joining, ... but this is beyond the scope of this short introduction. Here we just count the results to output the number of analyzed classes to the console.

Interested ?

I hope this will be enough to get you started.

If you have questions, I will be happy to answer them. You will find my email address on github (see "Open Source" above). Just ask the question on Stack Overflow first (or elsewhere), so that others can benefit from it, and then notify me.

If you have suggestions (or maybe want to contribute), you can do so on github using their issues and pull request facilities. There is already a lot of things that can easily be done. I have used "TODOs" in the code for this.

In any case, I'll be happy to hear from you !