Annotation Examples

Annotations

Annotations add metadata to source code that is (most of the time) used by compiled classes at runtime. The below is a list of popular ones in kuali, it is not meant to be a complete list.

  1. Java Annotations
    • @Deprecated - Java API 
      "A program element annotated @Deprecated is one that programmers are discouraged from using, [...]"
    • @Override - Java API 
      "Indicates that a method declaration is intended to override a method declaration in a superclass or implement a method in an interface."
    • @SuppressWarnings - Java API 
      "Indicates that the named compiler warnings should be suppressed in the annotated element [...]"
      Please don't suppress warnings just because you can. (smile) Make an educated decision.
    • There is more to annotations then predefined ones. Consult Java documentation for more complete reading (such as their tutorial).
  2. Spring Framework annotations
    • @Transactional - Spring API 
      "[...] whether a given exception should cause transaction rollback [...]"
  3. Kuali annotations. Documentation is partial snippet from kuali source code.
    • @AnnotationTestSuite
      "[...] marks test classes or methods as members of the listed test suites."
    • @ConfigureContext
      "[...] configure the appropriate context for the methods in a test that extends KualiTestBase."
      session = KHUNTLEY, initializeBatchSchedule=true, shouldCommitTransactions=true
    • @RawSQL
      "Used to reference classes/methods/constants which contain SQL statements rather than OJB calls."
    • @RelatesTo
      "[...] marks test classes or methods which have failed for reasons relating to certain JIRA issues."