« Return to Thread: Parse context - class or map?

RE: Parse context - class or map?

by Uwe Schindler :: Rate this Message:

Reply to Author | View in Thread

That looks very similar to our AttributeSource in Lucene 2.9/3.0 :-)

I like the type safety and coolness of the generics... :-)

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@...


> -----Original Message-----
> From: Jukka Zitting [mailto:jukka.zitting@...]
> Sent: Wednesday, November 11, 2009 7:33 PM
> To: tika-dev
> Subject: Parse context - class or map?
>
> Hi,
>
> Another quick design question: Is it better to use a Map<String,
> Object> for the TIKA-275 parse context, or should we have an explicit
> ParseContext class for that?
>
> The Map approach was simple to implement, but in the long term it
> might be better to use a separate class as it gives us an easy way to
> extend the design if needed. Also, the class approach would make it
> easy to centralize things like type safety and default value handling.
>
> This is what I had in mind:
>
>     public class ParseContext {
>         public <T> T get(Class<T> key) { ... }
>         public <T> T get(Class<T> key, T defaultValue) { ... }
>         public <T> void set(Class<T> key, T value) { ... }
>     }
>
> BR,
>
> Jukka Zitting

 « Return to Thread: Parse context - class or map?