dcsimg
Folder.getType() question.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Friday, November 9, 2001 06:56 AM

I'm a relatively new JavaMail developer. I'm working on a JavaMail SPI. I find a discrepancy between the documentation of Folder.getType() and a provided demo, and was looking to learn which is the correct: Documentation: public abstract int getType () throws MessagingException Returns the type of this Folder, that is, whether this folder can hold messages or subfolders or both. The returned value is an integer bitfield with the appropriate bits set. This method can be invoked on a closed folder. Demo: Source: client.FolderTreeNode.isLeaf() /** * a Folder is a leaf if it cannot contain sub folders */    More>>

I'm a relatively new JavaMail developer. I'm working on a JavaMail SPI.


I find a discrepancy between the documentation of Folder.getType() and a provided demo, and was looking to learn which is the correct:

Documentation:

			
public abstract int getType ()
throws MessagingException

Returns the type of this Folder, that is, whether this folder can hold
messages or subfolders or both. The returned value is an integer
bitfield with the appropriate bits set. This method can be invoked
on a closed folder.



Demo: Source: client.FolderTreeNode.isLeaf()

			
/**
* a Folder is a leaf if it cannot contain sub folders
*/
public boolean isLeaf() {
try {
if ((folder.getType() & Folder.HOLDS_FOLDERS) == 0)
return true;
}
catch (MessagingException me)
{ }


Question:

The code seems to imply that the folder type depends on weither it contains folders or messages, while the documentation seems to imply that the folder type depends on weither the provider implementation allows a folder to have messages or subfolders. The keyword being "can" rather than "does".

Is there someone in a position to say which is the correct one? Thanks in advance.

-w    <<Less

Re: Folder.getType() question.

Posted By:   Anonymous  
Posted On:   Friday, November 9, 2001 08:54 AM

I take it back, my mistake.

(I think I need more coffee :)

-w
About | Sitemap | Contact