What the exact responsibility of your EnforcementHandler
is, is ambiguous.
Going by the „Handler“ part of its name, suggests to me that its responsibility is to „handle“ things. So this seems an appropriate implementation to my understanding…
public class EnforcementHandler<M extends Message> implements Handler<M>{
public void handle( M msg ) { out.printf( "%1$70s%n ", msg.read( ) ); }
}
This demo shows how it could be used…
...
Message msg = ( ) -> "Friends of space, how are you all? Have you eaten yet? Come visit us if you have time.";
EnforcementHandler< Message > handler = new EnforcementHandler< >( );
handler.handle( msg );
...
…Printing this friendly message to stdout
…
Friends of space, how are you all? Have you eaten yet? Come visit us if you have time.