Generate POJOs - Source code (schema information)
Hi guys
i tried to add functionality to the scripted extension "Generate POJOs.groovy". But this is really hard to achieve without any documentation or source code out there.
For example, i want to add a table annotation with the used schema of a specific table. But i have no clue, where to retrieve the schema name using one of the following classes:
- import com.intellij.database.model.DasObject
- import com.intellij.database.model.DasTable
- import com.intellij.database.util.DasUtil
Can you give me a hunch, where i find possible methods/fields of these classes?
Thanks in advance
Daniel
请先登录再写评论。
Daniel,
Look for `lib/src/src_database-openapi.zip` file in IntelliJ IDEA Ultimate distribution. That is a complete source code for database and SQL APIs.
For my conrete problem (table schema name) i found a solution using reflection to return all methods of various classes:
did the trick.
But i would still like to know, if there is documentation or at least source code for this groovy code?
Sorry, but this article only is an example and leads to further examples.
What i want is an API or source code, so i can see what possibilities are there (methods, fields, classes ...).
Without API/source code you have to reverse engineer, what could be possible to create classes with Groovy.
Thank you so much Gregory, that is exactly what i was looking for.
Really great stuff, to create custom classes (or anything else) based on the DB model.
With best regards
Daniel
I hope the following article https://blog.jetbrains.com/datagrip/2018/02/13/generate-pojos/ will help you