CHAPTER 10 PLUGGABLE ANNOTATION PROCESSING UPDATES 187
CHAPTER 10 PLUGGABLE ANNOTATION PROCESSING UPDATES 187 However, because of the @Override, you learn at compile time that there are problems, as shown in the following snippet: > javac Over.java Over.java:6: method does not override a method from its superclass @Override ^ 1 error Thus, you can fix the problem sooner and more cheaply because it is identified much earlier in the process. JDK 6.0 Annotations JSR 175 defined the original metadata facility of JDK 5.0. JSR 269 introduces the Pluggable Annotation Processing API, which is a part of JDK 6.0. This standardizes some processing that was difficult at best with JDK 5.0 when creating your own annotations. In addition to this standardization, JDK 6.0 adds its own set of new annotations, many of which have been described in earlier chapters. We ll look at the new annotations first. New Annotations There is no single place I could find that listed all the annotations, new and old. The best you can do is grep through the source and find the classes defined with an @interface, as in the following line: public @interface ResultColumn { When defining your own annotations, that is the syntax for how they are declared. Here is information about all the annotations in JDK 6.0. Why use them for your classes? Because tools that know about them can be made smarter to make your life as a developer easier. The java.beans Package The first annotation, @ConstructorProperties, is used in conjunction with a JavaBeans component constructor. If you are using a third-party library with an IDE and don t necessarily know the names or order of the arguments to the constructor (but you do know their types), the @ConstructorProperties annotation can be used to designate their appropriate order by name. Thus, the IDE can present names for arguments, not just types. Listing 10-4 shows what using the @ConstructorProperties annotation might look like for a fictitious Point class with two properties, x and y, of the same type.
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services