Support toString generation for objects and traits.