O'Reilly logo

Java 9 Programming By Example by Peter Verhas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting annotations

We will extend the ProductInformation class with the following field:

private List<Class<? extends Annotation>> check;

Since this is a DTO, and Spring needs the setters and getters, we will also add a new getter and setter to it. This field will contain the list of classes that each class implement one of our annotations and also the built-in JDK interface, Annotation, because that is the way the Java compiler generates them. At this point, this may be a bit murky but I promise that the dawn will break and there will be light as we go on.

To get the product information, we have to look it up by ID. This is the interface and service that we developed in the last chapter, except, this time, we have another new field. This ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required