Add serialize/deserialize methods for annotations