Prompt and non-prompt J / ψ production and nuclear modification at mid-rapidity in p–Pb collisions at √sNN = 5.02 TeV