lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shai Erera <ser...@gmail.com>
Subject Re: How to deal with Token in the new TS API
Date Sun, 22 Nov 2009 13:28:56 GMT
ok so from what I understand, I should stop working w/ Token, and move to
working w/ the Attributes.

addAttribute indeed does not work. Even though it does not through an
exception, if I call in.addAttribute(Token.class), I get a new instance of
Token and not the once that was added by in. So this is even more severe
than just not blocking this option.

I thought I can move to use addAttributeImpl, but that won't help me,
because I won't be able to call getAttribute(Token.class).

So this leaves me w/ just working w/ the interfaces.

What do I need to do in order to clone an attribute? Previously I used
token.copyTo(target). How I can do it now if I don't have copyTo on the
interfaces, and/or clone?

Shai

On Sun, Nov 22, 2009 at 2:58 PM, Uwe Schindler <uwe@thetaphi.de> wrote:

> > But I do use addAttribute(Token.class), so I don't understand why you say
> > it's not possible. And I completely don't understand why the new API
> > allows
> > me to just work w/ interfaces and not impls ... A while ago I got the
> > impression that we're trying to get rid of interfaces because they're not
> > easy to maintain back-compat with ...
>
> AddAttribute(Token.class) should throw an Exception, but it doesn't (it's a
> bug in 3.0). addAttribute should only affect interfaces, it also accepts
> Token, because the AttributeFactory accepts it - bang.
>
> Sorry, but you can only pass attribute class literals to
> addAttribute/getAttribute/hasAttribute and so on.
>
> Sorry.
>
> Uwe
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message