WithTraits to apply traits to object instances