You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/10/02 19:14:57 UTC

[GitHub] [beam] kennknowles commented on a change in pull request #13003: [BEAM-10989] Add @SchemaCaseFormat annotation

kennknowles commented on a change in pull request #13003:
URL: https://github.com/apache/beam/pull/13003#discussion_r499005140



##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/FieldValueTypeInformation.java
##########
@@ -118,6 +123,29 @@ public static FieldValueTypeInformation forField(Field field) {
         .build();
   }
 
+  public static <T extends AnnotatedElement & Member> String getNameOverride(
+      String original, T member) {
+    SchemaFieldName fieldName = member.getAnnotation(SchemaFieldName.class);
+    SchemaCaseFormat caseFormatAnnotation = member.getAnnotation(SchemaCaseFormat.class);
+    SchemaCaseFormat classCaseFormatAnnotation =
+        member.getDeclaringClass().getAnnotation(SchemaCaseFormat.class);

Review comment:
       I hate inheritance but I have to ask: what happens with
   
   ```
   @SchemaCaseFormat(A)
   class Parent {
     ... fields ...
   }
   
   @SchemaCaseFormat(B)
   class Child extends Parent { }
   ```
   
   I'm honestly not sure what should happen. I think in your case anything not overridden will get case format A. That seems right but just want to highlight it.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org