Accessor to set the right field automatically, based on the value type.