Hi Jukka,

I would really like to have an explicit ParseContext class rather than a 
generic Map which provides little to no information as to its structure or how 
it will be used.

+1 for ParseContext...

Cheers,
Chris



On 11/11/09 11:33 AM, "Jukka Zitting" <jukka.zitt...@gmail.com> wrote:

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


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Chris Mattmann, Ph.D.
Senior Computer Scientist
NASA Jet Propulsion Laboratory Pasadena, CA 91109 USA
Office: 171-266B, Mailstop: 171-246
Email: chris.mattm...@jpl.nasa.gov
WWW:   http://sunset.usc.edu/~mattmann/
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Adjunct Assistant Professor, Computer Science Department
University of Southern California, Los Angeles, CA 90089 USA
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


Reply via email to