Note that there are some explanatory texts on larger screens.

plurals
  1. POIntelligent search and generation of Java code, preferrably using Python?
    primarykey
    data
    text
    <p>Basically, I do lots of one-off code generation, large-scale refactorings, etc. etc. in Java.</p> <p>My tool language of choice is Python, but I'll take whatever solutions you can offer.</p> <hr> <p>Here is a <em>simplified</em> illustration of what I would like, in a pseudocode</p> <p><strong>Generating an implementation for an interface</strong></p> <pre><code>search within my project: for each Interface as iName: write class(name=iName+"Impl", implements=iName) search within the body of iName: for each Method as mName: write method(name=mName, body="// TODO implement this...") </code></pre> <p>Basically, the tool I'm searching for would allow me to:</p> <ul> <li>parse files according to their Java structure ("search for interfaces")</li> <li>search for words contextualized by language elements and types ("variables of type SomeClass", "doStuff() method calls on SomeClass instances")</li> <li>to run searches with structural context ("within the body of the current result")</li> <li>easily replace or generate code (with helpers to generate, as above, or functions for replacing, "rename the interface to Foo", "insert the line Blah.Blah()", etc.)</li> </ul> <p>The point is, I don't want to spend a lot of time writing these things, as they are usually throwaway. But sometimes I need something just a little smarter than what grep offers. It wouldn't be too hard to write up a simplistic version of this, but if I'm going to use something like this at all, I'd expect it to be robust.</p> <p>Any suggestions of a tool/library that will help me accomplish this?</p> <hr> <p><strong>Edit to add some clarification</strong></p> <ol> <li>Python is definitely not necessary; I'll take whatever is that. I merely suggest it incase there are choices.</li> <li>This is to be used in combination with IDE refactoring; sometimes it just doesn't do everything I want.</li> <li>In instances where I'm using for code generation (as above), it's for augmenting the output of other code generators. e.g. a library we use outputs a tonne of interfaces, and we need to make standard implementations of each one to mesh it to our codebase.</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload