Generalized boxing/unboxing of field values