No need for all that extra, the constructor of ResourceLocation splits domains for you.