Quantcast
Viewing latest article 1
Browse Latest Browse All 3

Answer by Benjamin for Refactoring my simple model-view-presenter architecture

After reviewing this code a few times I've come to the conclusion that there is no way to express what I am trying to say in Java I.E the View class must implement an interface of type V as in the (illegal) snippet below.

public abstract class View<V, P extends Presenter<V>> implements V {}

This leaves me with the following options:

  1. Leave my code as is and accept the (minimal) redundancy.
  2. Remove some of the generic parameters and accept that if I configure my application incorrectly I will get an invalid cast exception.

Viewing latest article 1
Browse Latest Browse All 3

Trending Articles