A tool for creating dynamically generated code in Java (in Eclipse)

In Visual Studio, I used to define a structure in an XSD file and add a special attribute to it that would make it dynamically compile and be used for use with intellisense in other C # files in the application. I'm not sure what the term is, maybe "dynamic code generation".

I am trying to do the same in Java using the Eclipse IDE. Basically, what I'm looking for is a tool that will allow me to specify some kind of template and generate Java code from it in a "hot folder", which will allow me to complete the code in other static Java files.

Does anyone know of a solution for this? I know this is possible in Visual Studio, but I cannot find anything for Eclipse.

Well, thatโ€™s what I want to do.

Step 1. I create a folder called templates Step 2. I create a file HelloWord.ibes Step 3. Code is automatically generated in my src folder HelloWorld.java

I want this to be easy to do in eclipse.

+3
source share
2 answers

You can create an ant build file that the source generation creates for you. Then you can use any code generator that you like. ant support is part of the Eclipse IDE. If you prefer maven, there is a good eclipse plugin there (which I actually use to generate source code based on jaxb, javacc and xdoclet ...).

, eclipse, , eclipse .

, , .

Edit

, : . maven maven (m2eclipse) maven . , ( "" ), .

ant, , ant . "" ant , . , ( , ant , , ).

ant : Apache Ant

, java eclipse . , ;)

+4

, ?

Preferences. Java, Code Style, Code Templates

  • < href= "http://www.java-tips.org/other-api-tips/eclipse/how-to-add-your-own-code-template-in-eclipse.html" rel= "nofollow noreferrer" >
  • < href= "http://eclipse.dzone.com/articles/useful-eclipse-code-templates" rel= "nofollow noreferrer" >
+3

Source: https://habr.com/ru/post/1727644/


All Articles