[ 
https://issues.apache.org/jira/browse/BEAM-4454?focusedWorklogId=174251&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-174251
 ]

ASF GitHub Bot logged work on BEAM-4454:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 11/Dec/18 20:04
            Start Date: 11/Dec/18 20:04
    Worklog Time Spent: 10m 
      Work Description: kanterov commented on a change in pull request #7233:  
[BEAM-4454] Add remaining functionality for AVRO schemas
URL: https://github.com/apache/beam/pull/7233#discussion_r240582493
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/utils/JavaBeanUtils.java
 ##########
 @@ -49,23 +49,27 @@
 import org.apache.beam.sdk.schemas.utils.ByteBuddyUtils.ConvertValueForGetter;
 import org.apache.beam.sdk.schemas.utils.ReflectUtils.ClassWithSchema;
 import org.apache.beam.sdk.schemas.utils.StaticSchemaInference.TypeInformation;
+import org.apache.beam.sdk.transforms.SerializableFunction;
 import org.apache.beam.sdk.util.common.ReflectHelpers;
 
 /** A set of utilities to generate getter and setter classes for JavaBean 
objects. */
 @Experimental(Kind.SCHEMAS)
 public class JavaBeanUtils {
   /** Create a {@link Schema} for a Java Bean class. */
-  public static Schema schemaFromJavaBeanClass(Class<?> clazz) {
-    return StaticSchemaInference.schemaFromClass(clazz, 
JavaBeanUtils::typeInformationFromClass);
+  public static Schema schemaFromJavaBeanClass(
+      Class<?> clazz, SerializableFunction<String, String> fieldNamePolicy) {
+    return StaticSchemaInference.schemaFromClass(
+        clazz, c -> JavaBeanUtils.typeInformationFromClass(c, 
fieldNamePolicy));
   }
 
-  private static List<TypeInformation> typeInformationFromClass(Class<?> 
clazz) {
+  private static List<TypeInformation> typeInformationFromClass(
+      Class<?> clazz, SerializableFunction<String, String> fieldNamePolicy) {
 
 Review comment:
   All usages of `schemaFromJavaBeanClass` and`typeInformationFromClass` I've 
found use `identify()` function. I'm not sure it is needed. If it is needed, 
can you please add a test with non-identity function? It isn't clear from the 
code why `TypeInformation.forGetter(m, fieldNamePolicy)` is using 
`fieldNamePolicy`, but `TypeInformation.forSetter(m)` isn't

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 174251)
    Time Spent: 7h 10m  (was: 7h)

> Provide automatic schema registration for AVROs
> -----------------------------------------------
>
>                 Key: BEAM-4454
>                 URL: https://issues.apache.org/jira/browse/BEAM-4454
>             Project: Beam
>          Issue Type: Sub-task
>          Components: sdk-java-core
>            Reporter: Reuven Lax
>            Assignee: Reuven Lax
>            Priority: Major
>          Time Spent: 7h 10m
>  Remaining Estimate: 0h
>
> Need to make sure this is a compatible change



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to