Implement an abstract class for Mappers. It should receive two generic parameters for a data and domain classes like so:
Java
public abstract class Mapper<MODEL, DATA>
{
public abstract MODEL dataToModel(DATA data);
public abstract DATA modelToData(MODEL model);
public List<MODEL> dataToModel(List<DATA> list)
{
List<MODEL> models = new ArrayList<>();
for (DATA data : list)
{
models.add(dataToModel(data));
}
return models;
}
public List<DATA> modelToData(List<MODEL> models)
{
List<DATA> list = new ArrayList<>();
for (MODEL model : models)
{
list.add(modelToData(model));
}
return list;
}
}
Implement an abstract class for Mappers. It should receive two generic parameters for a data and domain classes like so:
Java