> Before writing a new class to support address parsing, can't you extend the
> javax.mail.InternetAddress class and ass the functionality?
>

I have to admit you are totally right that's why I'll recode my class as an
InternetAddressExtension.

> Sincerely,
> Anthony Eden
>
> ----------
> >From: "Roberto Lo Giacco" <[EMAIL PROTECTED]>
> >To: "Java Apache Mail Server" <[EMAIL PROTECTED]>
> >Subject: Re: New mailet API proposed
> >Date: Thu, Aug 31, 2000, 1:27 PM
> >
>
> >> Roberto Lo Giacco wrote:
> >> > 5. Suppress the MailetUtils class which actual functionalities could be
> >> > obtained using the Address class which will have static methods to
parse a
> >> > String returning the host part or the user part.
> >>
> >> Ugh... I'm spending too much javadoc writing without writing enough
> >> code.  Neither Address nor InternetAddress support separating the
> >> username from the hostname in an email address.  Address is pretty much
> >> worthless and InternetAddress only separates personal name from email
> >> (e.g., "Serge Knystautas" <[EMAIL PROTECTED]>).  So, returning the
> >> spec to use String instead of InternetAddress, and recreating
> >> MailetUtils.
> >
> > I knew those two classes were not accomplishing our needs, that's why I
> > proposed the "intoroduction" ( I mean write it from scratch ) of the
Address
> > (may be MailAddress is a better name) class:
> >
> > public class MailAddress {
> >     protected String personalName;
> >     protected String user;
> >     protected String host;
> >
> >     public MailAddress(final String mailAddress)
> >             throws MalformedAddressException {
> >         new MailAddress(mailAddress,mailAddress);
> >     }
> >
> >     public MailAddress(final String personalName, final String
mailAddress)
> >             throws MalformedAddressException {
> >         if ((int atIndex = mailAddress.indexOf('@')) < 0) {
> >             throw new MalformedAddressException();
> >         }
> >         this.personalName = personalName;
> >         this.user = mailAddress.substring(0,atIndex);
> >         this.host = mailAddress.substring(atIndex + 1);
> >     }
> >
> >     public String getHost(final String mailAddress)
> >             throws MalformedAddressException {
> >         return this.host;
> >     }
> >
> >     public String getUser(final String mailAddress)
> >             throws MalformedAddressException {
> >         return this.user;
> >     }
> >
> >     public static String getHost(final String mailAddress)
> >             throws MalformedAddressException {
> >         return new MailAddress(mailAddress).getHost();
> >     }
> >
> >     public static String getUser(final String mailAddress)
> >             throws MalformedAddressException {
> >         return new MailAddress(mailAddress).getUser();
> >     }
> > }
> >
> > To improve performances we have to make as much as possible final, but I
don't
> > know what we wish make final and what not: may be we can finalize
everything
> > but this whould deny further improvements and this is not a good API
approach
> > IMO.
> >
> > Roberto
> >
> >
> >
> > ------------------------------------------------------------
> > To subscribe:        [EMAIL PROTECTED]
> > To unsubscribe:      [EMAIL PROTECTED]
> > Archives:  <http://www.mail-archive.com/james%40list.working-dogs.com/>
> > Problems?:           [EMAIL PROTECTED]
> >
>
>
> ------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]
> Archives:  <http://www.mail-archive.com/james%40list.working-dogs.com/>
> Problems?:           [EMAIL PROTECTED]
>



------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives:  <http://www.mail-archive.com/james%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to