You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Steven Pannell <st...@zooplus.com> on 2005/12/23 11:00:27 UTC

Why is Document final?

Hi,

Can someone please tell my why the Document class has no interface and is
final?

I want to create some documents that have some standard fields (eg: creation
date), and I don't want to keep repeating my code.  This way I ensure some
standard conventions in all my documents.

What's the reason behind this? What's the argument against making an
interface and not having the document final?

look forward to some replies.
thanks
Steve.


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


Re: Why is Document final?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Dec 23, 2005, at 5:00 AM, Steven Pannell wrote:
> Can someone please tell my why the Document class has no interface  
> and is
> final?

Primarily because Lucene controls the construction of Document  
instances returned from Hits.

> I want to create some documents that have some standard fields (eg:  
> creation
> date), and I don't want to keep repeating my code.  This way I  
> ensure some
> standard conventions in all my documents.

You could ensure this by writing a wrapping method or class that  
creates Documents for you.

> What's the reason behind this? What's the argument against making an
> interface and not having the document final?

How would Lucene reconstruct the Document instance from Hits using  
your own implementation?

	Erik


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