Add a `checkNotNull` check for the mandatory fields and annotate the optional ones with `@Nullable`.