Tvrd
Tvrd

Reputation: 53

Java annotation that disregards method call if a condition is not satisfied

Is there a way in Java to make an annotation you put before a method to check if a boolean or any variable is defined/a-certain-value and if it's not it disregards the call to the method (no code from the method will be executed)?

Upvotes: 0

Views: 217

Answers (1)

Filipe Teixeira
Filipe Teixeira

Reputation: 3565

Annotations just provide metadata about your code. They cannot directly influence your code without the use of tools such as JUnit. As stated here:

Annotations, a form of metadata, provide data about a program that is not part of the program itself. Annotations have no direct effect on the operation of the code they annotate.

Upvotes: 1

Related Questions