Added ClassName::fromObject method and companion test case.

OK.