Pattern Suggestion for Extractor Classes

I currently have several "extractor" type classes and I am curious if there is a more efficient way of doing what I am doing now.

Let me explain with examples:

I have several Extractor classes called

SnowExtractor

WindExtractor

MetaExtractor

DepthExtractor

etc.

each extractor looks very similar but is different in the sense that it extracts different things that relate to it.

SnowExtractor will have methods like

getSnowDepth(Bufr)

getSnowTemp(Bufr)

WindExtractor will have methods like

getAverageWindSpeed(Bufr)

get15MinWindSpeed(Bufr)

etc

MetaExtractor

getDay(Bufr)

getHour(Bufr)

getMonth(Bufr)

etc.

this same sort of thing follows through out each extractor where a "Bufr" object is given to each extractors method and it is manipulated to extract the information it needs.

I have a few of these extractors

I think the way I have it currently setup is kind of inefficient and I found out just now how much of a pain it is. I have changed the definition of the Bufr object recently and am now faced with updating all those extractors so that they reference the Bufr correctly.

I looked through most of the GOF pattern and couldn't relate any pattern to my case. Is there a pattern or a better way of doing what I'm doing?

The Bufr object seems like it can be some how differently passed around so that it minimizes future code changes.

[1500 byte] By [quadfxa] at [2007-10-3 5:27:04]
# 1

I believe you should do just one helper class maybe called BuffUtil or something like that with those methods being static.

Maybe you can do what I said and let each method called a private method for example... extract(buff, string pattern) that extracts some value from the buff given the pattern. And each public method like getDay(Bufr) call that extract(buff, pattern) passing the corresponding extraction pattern.

jfreebsda at 2007-7-14 23:34:21 > top of Java-index,Other Topics,Patterns & OO Design...