April 2017
Beginner
504 pages
14h 11m
English
Annotate the declaration of the annotation with @Repeatable to denote that the annotation can be applied multiple times at one place. The parameter to this annotation is an annotation type that should have a parameter of type, which is an array of this annotation. Don't try to understand! I'll give an example instead. I already have, in fact: we have @PoweredDevices. It has an argument that is an array of @ParameteredPoweredDevice. Consider that we now annotate this @interface as the following:
... @Repeatable(PoweredDevices.class) public @interface ParameteredPoweredDevice { ...
Then, we can simplify the use of @ParameteredPoweredDevice. We can repeat the annotation multiple times and the Java runtime will automatically ...
Read now
Unlock full access