I'm developing an SPI and would like to define a Reportable interface such that any implementations must override toString() to something that is meaningful.
Is there any way in Java to write an interface such that any of its concrete implementations must override Object's toString()? For instance:
public interface Reportable
{
public String toString();
}
public class Widget implements Fizz, Buzz, Reportable
{
// ...
@Override
public String toString()
{
// ...
}
}
I know the above code doesn't force this kind of behavior, but is an example of what I'm looking for, i.e. if Widget doesn't override toString() you get a compile error because its violating the interface contract.