0
My Enum is returning Null Pointer when re-running this call:
System.out.println(DefinicaoSCM.getDefinicaoSCMPorDisciplina(Disciplina.IMPLEMENTACAO));
Implementation:
public enum DefinicaoSCM
{
DESCONHECIDO(null, "NA", "NA"),
IMPLANTACAO(Disciplina.IMPLANTACAO, "ipl_", "/Implantacao"),
IMPLEMENTACAO(Disciplina.IMPLEMENTACAO, "imp_", "/Implementacao", "/Documentacao", "/Implantacao"),
INTERFACE_GRAFICA(Disciplina.INTERFACE_GRAFICA, "ifg_", "/Design"),
PROJETO(Disciplina.PROJETO, "prj_", "/Projeto"),
REQUISITO(Disciplina.REQUISITO, "req_", "/Requisitos"),
TESTE(Disciplina.TESTE, "tst_", "/Teste");
private static Map<Disciplina, DefinicaoSCM> definicaoSCMPorDisciplina;
private Disciplina disciplina;
public static DefinicaoSCM getDefinicaoSCMPorDisciplina(Disciplina disciplina)
{
return definicaoSCMPorDisciplina.get(disciplina);
}
definicaoSCMPorDisciplina
is not instantiated.– Genos
Can you post your entire code from this class? In particular I would like to know about the constructor and how the
definicaoSCMPorDisciplina
is instantiated and populated.– Victor Stafusa
Although I don’t have the complete code, I’ve had problems using a Map in an Enum before. I suggest trying with an Immutablemap from Guava. I’ll find what I did to solve and put the code in after.
– Marcus Martins