thx thomas (you seem to answer all "a&p" questions of the world)

so you mean i have to provide an implementation (rather then an extension) 
of "PlaceHistoryMapper"? will @WithTokenizers work on that? Or do i have to 
implement all stuff for all places? or to make it simple (at least for me 
;-)) could you probably  give me a draft of " 
PlaceHistoryMapperWithFactory".

On Thursday, 8 March 2012 13:10:09 UTC+1, Thomas Broyer wrote:
>
>
>
> On Thursday, March 8, 2012 12:37:19 PM UTC+1, tanteanni wrote:
>>
>> Sometimes i have two places that differ only in thier prefix. For example 
>> a "SelectionPlace" and a "ResultOfSelectionPlace". So both places share all 
>> code but differ in @Prefix(value"..."). At the moment i implemented this by 
>> using an abstract class but i have to copy the code of the tokenizer to get 
>> tokenizers with different prefixes.
>>
>> Is there a way to let the concrete class only set the prefix of a shared 
>> tokenizer class? Or is there probably a complete different way to achieve 
>> this?
>>
>
> I believe it's possible using a parameterized tokenizer, a 
> PlaceHistoryMapperWithFactory and using the @Prefix on the factory methods 
> rather than on the tokenizer class:
>
> class FooPlace extends AbstractMyPlace { }
> class BarPlace extends AbstractMyPlace { }
> abstract class AbstractMyPlace extends Place {
>     static class Tokenizer<T extends AbstractMyPlace> extends 
> PlaceTokenizer<T> { … }
>     …
> }
>
> class MyFactory {
>   @Prefix("foo")
>   public PlaceTokenizer<FooPlace> foo() { return new 
> AbstractMyPlace.Tokenizer<FooPlace>(); }
>   @Prefix("bar")
>   public PlaceTokenizer<BarPlace> bar() { return new 
> AbstractMyPlace.Tokenizer<BarPlace>(); }
> }
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-web-toolkit/-/Zjvj8rj327MJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to