2015 | OriginalPaper | Chapter
15. Adding Annotations
Published in:
Pro Java 8 Programming
Abstract
A very useful part of Java is its support for annotations, which are used to define what is sometimes referred to as metadata. To understand what benefits this feature provides, it’s helpful to first realize that the definition of metadata is “data about data.” In other words, metadata is information that describes other data. An example of where metadata has long been used in Java is the java.sql package that contains DatabaseMetaData, ResultSetMetaData, and the relatively new ParameterMetaData interfaces. As implied by the definition just mentioned and by their names, these classes encapsulate data that describes a database, a ResultSet, and parameter information, respectively. For example, ResultSetMetaData allows you to find out how many columns are represented within a ResultSet, the data types associated with those columns, and so on.