generating class from template and compile it.