It's not correct. You won't be able to use your class - You cannot use the return value in your static factory method (right now it won't compile, but I guess the return value is supposed to be Parser
). The visibility of the return value makes it inaccessible for anyone using your factory method.
A workaround would be to factor out a public interface that the inner class implements and use this as the return value for your factory method.