Github user ggevay commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2211#discussion_r77993831
  
    --- Diff: 
flink-core/src/main/java/org/apache/flink/api/java/typeutils/PojoTypeInfo.java 
---
    @@ -419,4 +481,61 @@ public String toString() {
                        return "NamedFlatFieldDescriptor [name="+fieldName+" 
position="+getPosition()+" typeInfo="+getType()+"]";
                }
        }
    +
    +   public static String accessStringForField(Field f) {
    +           String fieldName = f.getName();
    +           if (Modifier.isPublic(f.getModifiers())) {
    +                   return fieldName;
    +           }
    +           String getterName = "get" + 
Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1);
    +           Class parentClazz = f.getDeclaringClass();
    +           try {
    +                   parentClazz.getMethod(getterName, new Class[0]);
    +           } catch (NoSuchMethodException e) {
    +                   // No getter, it might be a scala class.
    +                   return fieldName + "()";
    +           }
    +           return getterName + "()";
    +   }
    +
    +   public static String modifyStringForField(Field f, String arg) {
    +           String fieldName = f.getName();
    +           if (Modifier.isPublic(f.getModifiers())) {
    +                   if (f.getType().isPrimitive()) {
    +                           return f.getName() + " = (" +
    +                                   
primitiveBoxedClasses.get(f.getType().getCanonicalName()).getCanonicalName() + 
")" + arg;
    --- End diff --
    
    Why do we need to cast to the boxed types if the field is non-boxed?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to