use reflection to generate instance