During my work, I keep seeing people creating a class which is merely a wrapper of Map. The only field is a Map instance and the only methods are some getXXX() which delegates to the map directly. I think these classes are very weak and unnecessary. Because the functionality is exactly like a map. The only difference is having a different name for get method.
What is your opinion? What is the reason we should or should not do this?
@Builder
public class XXXServiceHelper {
@NonNull
private final Map<String, String> mapping;
String getStartStateForShipmentOperation(String from) {
return mapping.get(from);
}
}
Aucun commentaire:
Enregistrer un commentaire