Annotation Type SubSection
Specifies that an interface is a configuration subsection. This is a type level annotation, meaning it can be
applied not just to return types, but also generic parameters of return types.
The following example is fully functional.
public interface BoredomEvaluationConfig {
default Map<String, @SubSection BoredomDetails> boredomFromMarvelMovies() {
return Map.of(
"Hulk", new BoredomDetails() {
public int minutesOfBoredom() { return 120; }
public boolean doYouWantIt() { return false; }
},
"Avengers", new BoredomDetails() {
public int minutesOfBoredom() { return 220; }
public boolean doYouWantIt() { return true; }
}
);
}
interface BoredomDetails {
@DefaultInteger(3)
int minutesOfBoredom();
@DefaultBoolean(true)
boolean doYouWantIt();
}
}
- Author:
- A248