• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ERMailAttachment - need a public getBodyPart()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ERMailAttachment - need a public getBodyPart()


  • Subject: Re: ERMailAttachment - need a public getBodyPart()
  • From: "Cheong Hee (Gmail)" <email@hidden>
  • Date: Wed, 8 Sep 2010 16:39:56 +0800

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@hidden)
Help/Unsubscribe/Update your Subscription:
 email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: ERMailAttachment - need a public getBodyPart()
      • From: Farrukh Ijaz <email@hidden>
References: 
 >ERMailAttachment - need a public getBodyPart() (From: "Cheong Hee (Gmail)" <email@hidden>)
 >Re: ERMailAttachment - need a public getBodyPart() (From: Farrukh Ijaz <email@hidden>)

  • Prev by Date: Re: ERMailAttachment - need a public getBodyPart()
  • Next by Date: Re: ERMailAttachment - need a public getBodyPart()
  • Previous by thread: Re: ERMailAttachment - need a public getBodyPart()
  • Next by thread: Re: ERMailAttachment - need a public getBodyPart()
  • Index(es):
    • Date
    • Thread