6
I have the interface below
public interface BaseRelatorioDTO extends Serializable {
public BaseFiltroDTO getFiltro();
public List<? extends BaseRespostasDTO> getRespostas();
}
And I’d like to create the method
public void setRespostas(final List<? extends BaseRespostasDTO> respostas);
But when creating this method, all classes that implement BaseRelatorioDTO
and already have this method begin to give the error
Name Clash: The method
setRespostas(List<? extends RespostaHorariosDTO>)
of typeRelatorioHorariosDTO
has the samesetRespostas(List<? extends BaseRespostasDTO>)
of typeBaseRelatorioDTO
but does not override it.
The following is an example of one of the classes:
public class RelatorioHorariosDTO implements BaseRelatorioDTO {
private static final long serialVersionUID = -3828618335258371680L;
private FiltroHorariosDTO filtro = new FiltroHorariosDTO();
private List<RespostaHorariosDTO> respostas = new ArrayList<RespostaHorariosDTO>();
@Override
public FiltroHorariosDTO getFiltro() {
return this.filtro;
}
@Override
public List<RespostaHorariosDTO> getRespostas() {
return this.respostas;
}
/**
* @param respostasParam the respostas to set
*/
public void setRespostas(final List<RespostaHorariosDTO> respostasParam) {
this.respostas = respostasParam;
}
}
If you look at my method setRespostas
wait as parameter a list of RespostaHorariosDTO
, this class is written as below:
public class RespostaHorariosDTO implements BaseRespostasDTO {
private static final long serialVersionUID = 5505724855293262084L;
// Atributos e métodos acessores
}
What I’m doing wrong that the method cannot be declared on the interface so I force all classes that implement BaseRelatoriosDTO
implement the method setRespostas
?
could show the implementation of
setRespostas(List) of type RelatorioCaixaVisitaEmpresaDTO
?– Math
@Math Uma is
RelatorioHorarios
the otherRespostaHorarios
.– Philippe Gioseffi
truth, sorry the mistake, could meet my first request then?
– Math
@Math I copied one of the errors that happened for all classes that implement
BaseRelatorioDTO
. This same mistake happens toRelatorioHorariosDTO
, I’ll change the name of the class in the error I reported, OK?– Philippe Gioseffi
@Math I’ve changed. Your request has been answered as you expected?
– Philippe Gioseffi
I believe that yes, is that I am without time now, I will be able to see it later, thanks
– Math
@Math I appreciate your help!
– Philippe Gioseffi