replace instanceof with polymorphism for property injection