Let me explain.
SingleSelectionModel<UsuarioDTO> selectionModel =
new SingleSelectionModel<UsuarioDTO>();
@Override
public UsuarioDTO getUsuarioSelecionado() {
return selectionModel.getSelectedObject();
}
I Call this when I want to get the selected UsuarioDTO, but when my application starts I dont have a UsuarioDTO selected so I will get a NullPointerException if a call this.
My question is: Can I compare something to avoid the NullPointer?
if (yourObject.getUsuarioSelecionado() == null) {
// do something if it is null
} else {
// do something with the DTO
yourObject.getUsuarioSelecionado().callSomeMethod();
}
Is that what you're looking for? Check if something is null
?