Home > OS >  Return value of the method is never used
Return value of the method is never used

Time:11-30

how to write a model class with getters and setters defined and returned

public Team(Long id,String queue,Number answered,Number offered, Number answerRate,Number abandoned,String avgAbandonTime,Number totalTalkTime,Number avgTalkTime, Number unmanaged) {
    this.id = id;
    this.queue = queue;
    this.answered = answered;
    this.offered = offered;
    this.answerRate = answerRate;
    this.abandoned = abandoned;
    this.avgAbandonTime = avgAbandonTime;
    this.totalTalkTime = totalTalkTime;
    this.avgTalkTime =  avgTalkTime;
    this.unmanaged=unmanaged;
}
//getters and setters..
}

CodePudding user response:

Every setter method's name must have set prefix & getter method's name must have get followed by camel cased property name. Example:

public void setQueue(String queue) {
    this.queue = queue;
}

public String getQueue() {
    return queue;
}

CodePudding user response:

If you're using IntelliJ the IDE has the option to automatically generate getters and setters for your class using "alt ins" see here

If you're getting that the "Return value of the method is never used." it is pretty straightforward, it means that you haven't referred to any of those methods anywhere at the moment.

  • Related