You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Shai Erera (Commented) (JIRA)" <ji...@apache.org> on 2012/02/07 17:08:59 UTC

[jira] [Commented] (LUCENE-3756) Don't allow IndexWriterConfig setters to chain

    [ https://issues.apache.org/jira/browse/LUCENE-3756?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13202498#comment-13202498 ] 

Shai Erera commented on LUCENE-3756:
------------------------------------

I disagree :). The fact that the API allows chaining (a builder pattern I think?) doesn't mean you need to use it. I find it very useful and convenient that I can do new IWC().setOpenMode() for example.

If you remove that capability, you will affect many people that like it, while those that don't like it can still call the setters one in each line.
                
> Don't allow IndexWriterConfig setters to chain
> ----------------------------------------------
>
>                 Key: LUCENE-3756
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3756
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>
> Spinoff from LUCENE-3736.
> I don't like that IndexWriterConfig's setters are chainable; it
> results in code in our tests like this:
> {noformat}
> IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer(random)).setMaxBufferedDocs(2).setMergePolicy(newLogMergePolicy()));
> {noformat}
> I think in general we should avoid chaining since it encourages hard
> to read code (code is already hard enough to read!).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org