[yan qian] refactor with method using generic.