I have the following class definition:
public class EnrichedArticle implements Serializable {
// ArticleEnvelope is generated via Protobuf
private ArticleProto.ArticleEnvelope article;
// Asset is a Java POJO
private List<Asset> assets;
public EnrichedArticle(ArticleProto.ArticleEnvelope article, List<Asset>
assets) {
this.article = article;
this.assets = assets;
}
}
I am trying to generate a SerializableFunction<EnrichedArticle, Row> and a
Schema for it so that I can pass it easily to my BigQueryIO at the end of
my pipeline. Transforming the article to a Row object is straightforward:
First I get the toRow() function for it via the helper:
new ProtoMessageSchema().toRowFunction(TypeDescriptor.of(
ArticleProto.ArticleEnvelope.class));
Then I just apply that function to the article field.
However I don't know how I can manually transform my list of assets (a
simple Java POJO annotated with: @DefaultSchema(JavaFieldSchema.class)
in my EnrichedArticle container/composition class. What's the recommended
way of doing this?