[
https://issues.apache.org/jira/browse/FLINK-1388?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14321633#comment-14321633
]
Adnan Khan commented on FLINK-1388:
-----------------------------------
Hey Timo,
So the rules for defining a POJO according to
[this|https://github.com/apache/flink/blob/master/docs/internal_types_serialization.md]
include this part {quote} All fields in the class (and all superclasses) are
either public or or have a public getter and a setter method that follows the
Java beans naming conventions for getters and setters. {quote}
So that means that it could have private fields. I was thinking we should add
{{field.setAccessible(true)}} in the implementation for {{PojoField}}.
Otherwise something like {{pFieldValue = pField.field.get(myPojo)}} does not
seem to work.
I ran into while I was testing the CSV writer with POJOs with private fields
but public getter/setters.
> POJO support for writeAsCsv
> ---------------------------
>
> Key: FLINK-1388
> URL: https://issues.apache.org/jira/browse/FLINK-1388
> Project: Flink
> Issue Type: New Feature
> Components: Java API
> Reporter: Timo Walther
> Assignee: Adnan Khan
> Priority: Minor
>
> It would be great if one could simply write out POJOs in CSV format.
> {code}
> public class MyPojo {
> String a;
> int b;
> }
> {code}
> to:
> {code}
> # CSV file of org.apache.flink.MyPojo: String a, int b
> "Hello World", 42
> "Hello World 2", 47
> ...
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)