combine java factory pattern and interface