Support for List and Map

Optional applies to the whole field so it only needs to be deal with once at the beginning. `generateElementWriteCode` recursively processes a nested type.