I'm trying to read the something from a context class and always got null. As I debuged it I found out that for some reason there isn't anything written in my context class.
Code where context gets written:
for (Mitarbeiter m : mitarbeiterList){
if (m.getName().equals(nameSuche)){
maController = m;
logger.info(m);
ContextMAAbrechnung.getInstance().setMitarbeiter(m);
}
}
Code of context class:
package slgp.gastrosoftware.gui.controller;
import slgp.gastrosoftware.model.Mitarbeiter;
public class ContextMAAbrechnung {
private static final ContextMAAbrechnung INSTANCE = new ContextMAAbrechnung();
private Mitarbeiter mitarbeiter;
private ContextMAAbrechnung() {}
public Mitarbeiter getMitarbeiter() {
return mitarbeiter;
}
public void setMitarbeiter(Mitarbeiter mitarbeiter) {
this.mitarbeiter = mitarbeiter;
}
public static ContextMAAbrechnung getInstance() {
return INSTANCE;
}
}
When setMitarbeiter is called it is not null: https://snag.gy/JKeFk7.jpg
As I get to the this.mitarbeiter = mitarbeiter
part one is null and the other isn't. https://snag.gy/BAuFey.jpg
What did I do wrong?