Extract all string from a java project

前端 未结 5 1702
青春惊慌失措
青春惊慌失措 2020-12-01 17:02

I have a rather big number of source files that I need parse and extract all string literals and put them in a file as play old java constant.
For exemple:



        
5条回答
  •  借酒劲吻你
    2020-12-01 17:32

    To complete Peter Kelley answer, you might consider for eclipse IDE the AST solution.

    You might then write an AST program which parse your source code and does what you want.

    A full example is available in this eclipse corner article, also more details in the eclipse help.
    And you can find some examples in Listing 5 of the section "Implementation of in-place translation" of Automating the embedding of Domain Specific Languages in Eclipse JDT, alongside multiple examples in GitHub projects.

提交回复
热议问题