This is an automated email from the ASF dual-hosted git repository.
robertwb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/master by this push:
new 61153bbda6a Update documentation of @SchemaFieldNumber (#30273)
(#30277)
61153bbda6a is described below
commit 61153bbda6abd5e2d6798544d5f5a81f08d15ee4
Author: bzablocki <[email protected]>
AuthorDate: Thu Apr 18 17:01:50 2024 +0200
Update documentation of @SchemaFieldNumber (#30273) (#30277)
---
.../org/apache/beam/sdk/schemas/annotations/SchemaFieldNumber.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
a/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/annotations/SchemaFieldNumber.java
b/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/annotations/SchemaFieldNumber.java
index 32110395f60..1bfcda7270b 100644
---
a/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/annotations/SchemaFieldNumber.java
+++
b/sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/annotations/SchemaFieldNumber.java
@@ -31,16 +31,19 @@ import javax.annotation.Nonnull;
* specified index. There cannot be "gaps" in field numbers, or schema
inference will fail. If used,
* all fields (or getters in the case of a bean) must be annotated.
*
+ * <p>The annotation takes a String as an argument, but this has to be an
Integer-parsable String.
+ * Otherwise the pipeline will throw a RuntimeException.
+ *
* <p>For example, say we have a Java POJO with a field that we want in our
schema but under a
* different name:
*
* <pre><code>
* {@literal @}DefaultSchema(JavaFieldSchema.class)
* class MyClass {
- * {@literal @}SchemaFieldNumber(1)
+ * {@literal @}SchemaFieldNumber("1")
* public String user;
*
- * {@literal @}SchemaFieldNumber(0)
+ * {@literal @}SchemaFieldNumber("0")
* public int ageInYears;
* }
* </code></pre>