java - Specify Generics in interface extends -


Should I specify solid type for normal type when extending an interface with an interface?

Do I mean, if I have any interface:

  public interface repo & lt; T & gt; {Collection & lt; T & gt; Search (string parameter); T obtained (string id); }   

and then a full bunch of specific repositories, such as ClientRepo , Customer Rippo , etc ... to specify this type Appropriate when this interface is extended, for example:

  Public Interface Client Rippo Repo & lt; Client & gt; {} Public Interface Expands Customer Rippo Repo & lt; Customers & gt; {}   

Where customers and customers are only a few classes.

Does anyone have any such problem? I mean I can:

  public interface client repo & lt; T & gt;   

Appendix : I should make my intention more clear to be a special repository (such as a client repo). There is another interface called RepoFactory that gives a proper repo to the customer, e.g.:

  Public Interface RepoFactory {ClientRepo createClientRepo (); Create customer repo customer repo (); }   

This factory is implemented by implementers , which, in turn, provide proper implementation of solid repo.

In fact, from the top you can say that the interface of the API repo & lt; T & gt; is not used.

I hope enough confusion !!! Sorry: (

Well it depends if your extended interface / class is normal, I also think that you want to do this

  the expansion of the public interface Client Rippo repo & lt; Customer & gt; {}   

  The public interface expands client repo & lt; T & gt; repo & lt; T & gt; {}   

you >

  Client Rippo> Customer & gt;   

Is not a desired behavior.

Comments