I want to register a custom formatter for handling Set<Integer>.
The obvious way:
Formatters.register(Set<Integer>.class, new AnnotationIntegerSetFormatter());
results in “Illegal start of expression”. What’s the right way to do this, or is it not possible?
Ended up using
Formatters.register(Set.class, new AnnotationIntegerSetFormatter());;parsecan still returnSet<Integer>and inprintjust cast theSettoSet<Integer>:and for completeness, the annotation I used:
Since this is annotation based, it appears you can register multiple formatters for a
Collectiontype and have them distinguished by the annotations.