Do you know an API to programmatically refactor Java code.
Update December 2012:
Jackpot API was quite complete for that kind of operation.
It has since been integrating in the Netbean API itself: "org-netbeans-modules-refactoring-api"
A other one is the LTK (Language toolKit) in Eclipse.