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 implements for 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 that there will be light at the end of the tunnel.

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

Get Java Projects - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.