According to the Flink doc, Flink recognizes a data type as a POJO type (and allows “by-name” field referencing) if the following conditions are fulfilled:
- The class is public and standalone (no non-static inner class) - The class has a public no-argument constructor - All non-static, non-transient fields in the class (and all superclasses) are either public (and non-final) or have a public getter- and a setter- method that follows the Java beans naming conventions for getters and setters. PojoSerializer uses Java reflection to access an object's fields. One of PojoSerializer's constructor calls setAccessible(true) for all fields. for (int i = 0; i < numFields; i++) { this.fields[i].setAccessible(true); } Then, to my knowledge, it can set a field regardless of the field's access control(private, public,..). However, its another constructor, called by PojoSerializerSnapshot, doesn't call setAccessible(true). Does anyone know the reason why setAccessible(true) is not called here? And why fields should be public or have a public gettter- and setter- method? Regards, Naehee