I just begin to maintain a Java MVC project which use Java Guice Framework.
In almost the entire code, first developers passed as parameter an empty model interface extending another interface.
Here's the first Interface:
public interface FooModel extends ModelInterface {
}
And the other interface:
public interface ModelInterface {
public void addListener(FooListener fooListener);
void setFoo(boolean blop);
boolean isFoo();
}
That does not make any sense for me.
Is there a good reason/pattern use empty interface, in Java? Maybe for Guice?
Here is a good motivation for "marker interfaces". They are especially useful in aspect-oriented programming where they give you a point to attach to (and I guess Guice is just such a framework).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With