Héritage multiple implicite
Bonjour,
J'ai besoin de remplacer un extends d'une classe Abstract en un implements de cette même classe Abstract.
Voilà ma classe Abstract
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| public abstract class ListeDynamique {
private CollectionsUtil collectionsUtil;
private String listPere1;
private String listFils1;
private Map<String,String> listKeyValuePere1 = new HashMap<String, String>();
private Map<String,Map<String,String>> relationKeyPere1ListeFils1 = new HashMap<String, Map<String,String>>();
private Map<String,String> listKeyValueFils1 = new HashMap<String, String>();
public abstract String getMapKeyEntityPere(Object entityPere);
public abstract String getMapValueEntityPere(Object entityPere);
public abstract String getMapKeyEntityFils(Object entityFils);
public abstract String getMapValueEntityFils(Object entityFils);
public abstract List<?> getListValuesEntityFilsDansEntityPere(Object entityPere); //la relation entre les 2 table
protected void transListToMap(List<?> listAllEntityPere){ //List<Wilaya> wilayas = this.getAllWialya();
List<?> ListEntityFils;
Map<String,String> tmpDairasStr = new HashMap<String, String>();
for(Object wil : listAllEntityPere) {
this.listKeyValuePere1.put(this.getMapKeyEntityPere(wil), this.getMapValueEntityPere(wil));
//recup la liste de daira
ListEntityFils = this.getListValuesEntityFilsDansEntityPere(wil);
for(Object dai : ListEntityFils) {
tmpDairasStr.put(this.getMapKeyEntityFils(dai), this.getMapValueEntityFils(dai));
}
//Affectation a "dairasStrsData"
this.relationKeyPere1ListeFils1.put(this.getMapKeyEntityPere(wil), tmpDairasStr);
tmpDairasStr = new HashMap<String, String>(); //tmpDairasStr.clear()
}
}
public void handleCityChange() { //je peut utiliser StringUtil
if(listPere1 !=null && !listPere1.equals(""))
listKeyValueFils1 = relationKeyPere1ListeFils1.get(listPere1);
else
listKeyValueFils1 = new HashMap<String, String>();
}
//*********** Setter and Getteur ***********
} |
Tout ça parce que j'ai besoin de faire plusieurs extends sur une même classe (en plus ça n'a pas de sens conceptuellement).
Quelqu'un saurait-il m'indiquer un pattern pour implémenter cela ?
Merci d'avance