0

I have some pre generated classes with method names to interact with Database. Here library automatically map method names with database properties to query based on some fixed convention.

This is very easy to use as i don't have to write explicit queries.

Here i want to protect method names from being refactored accidentally. If someone without deep knowledge, changes method names it breaks at runtime.

Is there any way to throw error at compile time by using annotation or some other way if any changes detected for some auto generated methods?

Rajeev
  • 4,762
  • 8
  • 41
  • 63
  • 1
    Usually generated sources should reside in a different place than the rest of the sources as they can be re-generated on demand, see e. g. https://stackoverflow.com/questions/22912900/location-of-generated-source-files-for-maven-directory-structure – Smutje Nov 19 '20 at 15:23
  • The simplest check is to have a unit test that calls the methods. Thus, when anyone changes the method signatures, the test will break. – Joachim Sauer Nov 19 '20 at 15:25

0 Answers0