james-mime4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Bagnara <apa...@bago.org>
Subject AbstractField.PARSER/getParser and dependencies
Date Thu, 24 Dec 2009 17:19:51 GMT
Hi all,

AbstractField is the abstract class extended by each specific field
implementation.

AbstractField, at the same time, provide "static" access to a
DefaultFieldParser and provides static methods to get a
DefaultFieldParser and to parse a string into a field using that
default field parser.

So every field extend abstractField but AbstractField have a link to
every of its implementations via DefaultFieldParser =>
DelegatingFieldParser.

This smells like a very bad idea. Is it me?

So, if you agree this should be improved here are 2 alternative solutions:
1) the easy fix would be to move all of the static stuff from
AbstractField to DefaultFieldParser. As the methods are public static
methods this would introduce a backward compatibility issue.
2) Leave only the static methods in AbstractField and create a new
"AField" (implementing ParsedField) object including the really
"inherited" stuff and make every implementation extends this AField
instead of AbstractField. Again this could lead to backward
incompatibility, but maybe a lot less compatibility issues than the
previous one.

Also, after this change DefaultFieldParser and Fields, currently in
the field package, would be only used by the message package classes,
so maybe they should be simply moved there.

Stefano

Mime
View raw message