On 20 May 2013 21:07, Romain Manni-Bucau <[email protected]> wrote: > Hi > > A real inline builder (withDelimiter(...)...) is better to get completion > and linear reading of the code IMO
What do you mean exactly by a real builder? Please show the exact syntax. > Static imports are not fine for everbody from my experience Nothing is going to be fine for everybody. But static imports seem to work quite well for JUnit4. > Le 20 mai 2013 22:05, "Benedikt Ritter" <[email protected]> a écrit : > >> Hi guys, >> >> a while back we had this discussion [1] about the current state of the >> CSVFormat API. We were still not completely happy with it and Oliver came >> up with a new suggestion [2]. >> This weekend I finally had some time to hack something together. I've >> created a mirror of CSV rev. 1484347 at github [3]. >> >> This proposal uses CSVFormatModifier objects to change a CSVFormat. The API >> relies on static imports of factory methods for CSVFormatModifiers and >> looks like the following: >> >> CSVFormat modifed = CSVFormat.DEFAULT.with( I don't like the DEFAULT; seems to me it could be dropped. >> delimiter(';'), >> noEscape(), >> commentStart('#')); Also, I think one could chain the method parameters like so: CSVFormat modifed = CSVFormat.using(CSVConfig.delimiter(',').noEscape().quote('"')); I think this would eliminate the need for static imports. >> So far I've implemented methods for changing delimiter, commentStart, >> escape and quote policy (have a look at CSVFormatModifierTest). The >> approach has the advantage of being short like the initial implementation, >> while making sure that CSVFormat is immutable and validated at construction >> time. The draw back however is, that it is a bit of a pain to get all the >> static imports in place (at least this is my feeling with Eclipse, any >> suggestions on how to work efficiently with static imports in eclipse are >> appreciated :) >> >> Now I'd like to ask you for feedback. Do you like this approach? Any >> suggestions? >> One thing I'm not sure about is MutableCSVFormat. Maybe this can be merged >> together with CSVFormatModifier. >> >> Regards, >> Benedikt >> >> >> [1] http://markmail.org/thread/o3s2a5hyj6xh4nzj >> [2] http://markmail.org/message/vjjdbckwr4dlqp2b >> [3] https://github.com/britter/apache-commons-csv-mirror >> >> >> -- >> http://people.apache.org/~britter/ >> http://www.systemoutprintln.de/ >> http://twitter.com/BenediktRitter >> http://github.com/britter >> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
