There is no issue to override the protected method. However, don't think I
want to subclass ERMailAttachment, which has been generally used in
ERMailDelivery. The code here in ERMailDelivery->finishMessagePrepration
method:
ERMailAttachment attachment = (ERMailAttachment)en.nextElement ();
BodyPart bp = attachment.getBodyPart();
bp.setDisposition (Part.ATTACHMENT);
multipart.addBodyPart (bp);
getBodyPart could not be visible if I will have to override
finishMessagePreparation in subclass ERMailDelivery (in another package). Hope
you get it, help my code please.
----- Original Message -----
From: Farrukh Ijaz
To: Cheong Hee (Gmail)
Cc: WO-Apple-Dev
Sent: Wednesday, September 08, 2010 4:13 PM
Subject: Re: ERMailAttachment - need a public getBodyPart()
On 2010-09-08, at 10:40 AM, Cheong Hee (Gmail) wrote:
Hi
I need to extend ERMailDelivery, and keep the new class in a new package.
The getBodyPart of ERMailAttachment is not visible since it is defined as
protected in er.javamail package. The subclasses ERMailDataAttachment,
ERMailFileTextAttachment and ERMailFileAttachment also keep the protect access
level. This may be a problem to those who would like to extend the
ERMailDelivery class, make modification to finishMessagePreparation and store
in a different package. Has anyone in the same situation or understand the
reason why getBodyPart is defined as protected? May be Anjo will do :)
Hi Cheong,
You can override a protected non-static method as long as it's not marked
"final".
A subclass inherits all of the public and protected members of its parent, no
matter what package the subclass is in. If the subclass is in the same package
as its parent, it also inherits the package-private members of the parent. You
can use the inherited members as is, replace them, hide them, or supplement
them with new members: [1]
Farrukh
References:
[1] http://download.oracle.com/javase/tutorial/java/IandI/subclasses.html
Cheers
Cheong Hee
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/farrukh.ijaz%40fuegodigitalmedia.com
This email sent to [email protected]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]