Bigquery:将类转换为Bigquery TableSchema

时间:2022-11-04 15:34:27

Do you know a way to convert a Java Class (which has been generated through jaxb from xsd and so contains XML bind annotation) to a Bigquery TableSchema.

您是否知道将Java类(通过jaxb从xsd生成并因此包含XML绑定注释)转换为Bigquery TableSchema的方法。

Or alternatively convert a JsonScheam to TableSchema.

或者将JsonScheam转换为TableSchema。

I have to do so for about 60 more or less complex class.

对于大约60个或更少复杂的课程,我必须这样做。

Best Regards

最好的祝福

1 个解决方案

#1


0  

Consider using reflection on your class to get a list of fields on the class and use it to generate the TableSchema. https://www.journaldev.com/1789/java-reflection-example-tutorial#all-public-fields

考虑在类上使用反射来获取类的字段列表并使用它来生成TableSchema。 https://www.journaldev.com/1789/java-reflection-example-tutorial#all-public-fields

Alternatively you can use this JavaClassParser, but reflection may be simpler.

或者,您可以使用此JavaClassParser,但反射可能更简单。

#1


0  

Consider using reflection on your class to get a list of fields on the class and use it to generate the TableSchema. https://www.journaldev.com/1789/java-reflection-example-tutorial#all-public-fields

考虑在类上使用反射来获取类的字段列表并使用它来生成TableSchema。 https://www.journaldev.com/1789/java-reflection-example-tutorial#all-public-fields

Alternatively you can use this JavaClassParser, but reflection may be simpler.

或者,您可以使用此JavaClassParser,但反射可能更简单。