mardi 12 décembre 2017

Interface implementation not using the method parameter.

I have one interface

public class interface {
   public void filter (List<Item> items, List<Obj1> obj1List, List<Obj2> obj2List)
}

There are two implementation for this.

public Class Filter1 {} and public Class Filter2 {} and public Class Filter3 {}

Filter1 used obj1List to filter the items and Filter2 used obj2List to filter the items and Filter3 used obj1List and obj2List to filter the items.

Here Class Filter1 would be having the extra obj2List as variable.

basically I want to have a filterChain which would iterate through all the filters in loop.

Is it ok to have variable in interface declaration that is not used in one implementation. ?

Aucun commentaire:

Enregistrer un commentaire