Annotation Interface UtilityClass


@ClassVersion(sourceVersion="$Id: UtilityClass.java 966 2022-01-04 22:28:49Z tquadrat $") @API(status=STABLE, since="0.1.0") @Documented @Retention(SOURCE) @Target(TYPE) public @interface UtilityClass

This is a marker annotation for a utility class.

A utility class is a class that …

  • … is final
  • … has only a private constructor that throws a PrivateConstructorForStaticClassCalledError when called (that works only through reflection …) and therefore does not allow any instances
  • … has only methods that are static final
  • … has only static final attributes (constants) and therefore should not have any status

The class org.tquadrat.foundation.testutil.TestBaseClass for the org.tquadrat.foundation.testutil module provides a method validateAsStaticClass() that tests most of these conditions.

Author:
Thomas Thrien (thomas.thrien@tquadrat.org)
Version:
$Id: UtilityClass.java 966 2022-01-04 22:28:49Z tquadrat $
Since:
0.1.0