You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Record<P> API has been generic from its inception, since the record's payload can be of any type. However, as of v6.1, most (if not all) APIs using Record<P> are not generic: RecordReader, RecordWriter, etc:
publicinterfaceRecordReader {
RecordreadRecord() throwsException; // using raw type// open/close methods omitted
}
Using raw types in those key APIs has a few drawbacks:
It is not type safe
It requires additional casts in custom implementations of processors, mappers, writers, etc.
It generates "raw types usage" warnings
The following snippet is a valid job definition in v6 that fails with a ClassCastException at runtime:
All APIs should be updated to use generics for more type safety, and especially JobBuilder which should enforce that record types are as expected and coherent between the reader, processor and writer. With that, the previous job definition should not compile until we explicitly specify the input/output types. A type safe version of such a job definition would be something like:
The
Record<P>
API has been generic from its inception, since the record's payload can be of any type. However, as of v6.1, most (if not all) APIs usingRecord<P>
are not generic:RecordReader
,RecordWriter
, etc:Using raw types in those key APIs has a few drawbacks:
The following snippet is a valid job definition in v6 that fails with a
ClassCastException
at runtime:All APIs should be updated to use generics for more type safety, and especially
JobBuilder
which should enforce that record types are as expected and coherent between the reader, processor and writer. With that, the previous job definition should not compile until we explicitly specify the input/output types. A type safe version of such a job definition would be something like:The text was updated successfully, but these errors were encountered: