Annotation Type UtilityClass
An annotation to create utility classes.
If a class is annotated with
@UtilityClass
, the following things happen to it:- It is marked final.
- If any constructors are declared in it, an error is generated. Otherwise, a private no-args constructor is generated; it throws a
UnsupportedOperationException
. - All methods, inner classes, and fields in the class are marked static.
- WARNING: Do not use non-star static imports to import these members; javac won't be able to figure it out. Use either:
import static ThisType.*;
or don't static-import.