com.sas.mail
Class Attachment

java.lang.Object
  |
  +--com.sas.mail.Attachment

public class Attachment
extends java.lang.Object

Attachment is a class for mail attachment objects. It contains the Object contents, a DataSource, or a DataHandler for the contents. It also stores the content type and a name for the attachment. Methods are also provided to get the editor or the viewer for the contents if a DataHandler is used.


Constructor Summary
Attachment(DataHandler dh, String attachmentName)
          Constructor for an Attachment using a DataHandler and a specific name.
Attachment(DataSource ds)
          Constructor for an Attachment using a DataSource.
Attachment(Object content, String type, String name)
          Constructor for an Attachment specifying the Object content, the content type, and the name of the Attachment.
 
Method Summary
 Object getContent()
          Get the content of the Attachment.
 String getContentType()
          Get the content type of the Attachment.
 DataHandler getDataHandler()
          Get the DataHandler of the Attachment.
 DataSource getDataSource()
          Get the DataSource of the Attachment.
 Component getEditor()
          Get the editor component for the Attachment.
 String getName()
          Get the name of the Attachment.
 Component getViewer()
          Get the viewer component for the Attachment.
 void setName(String attachmentName)
          Set the name of the Attachment.
 String toString()
          Get the string representation of this Attachment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attachment

public Attachment(DataHandler dh,
                  String attachmentName)
Constructor for an Attachment using a DataHandler and a specific name.
Parameters:
dh - a DataHandler containing the content for the Attachment
attachmentName - a String name for the Attachment

Attachment

public Attachment(DataSource ds)
Constructor for an Attachment using a DataSource.
Parameters:
ds - a DataSource content for the Attachment

Attachment

public Attachment(Object content,
                  String type,
                  String name)
Constructor for an Attachment specifying the Object content, the content type, and the name of the Attachment.
Parameters:
content - the Object content of the Attachment
type - the content type of the Attachment
name - the name of the Attachment
Method Detail

toString

public String toString()
Get the string representation of this Attachment. This is done using the Resource string attachmentName.txt from the Resource.properties file.
Overrides:
toString in class Object

getContent

public Object getContent()
Get the content of the Attachment. This will return the Object content if the Attachment was created using an Object content.
Returns:
the Object content of the Attachment

getContentType

public String getContentType()
Get the content type of the Attachment. If the DataSource was set, its contentType will be queried.

getDataHandler

public DataHandler getDataHandler()
Get the DataHandler of the Attachment.
Returns:
the DataHandler if the Attachment was created with a DataHandler or null if it wasn't.

getDataSource

public DataSource getDataSource()
Get the DataSource of the Attachment.
Returns:
the DataSource if the Attachment was created with a DataHandler with a DataSource, a DataSource or null if it was created with an Object.

getName

public String getName()
Get the name of the Attachment.
Returns:
the name of the Attachment, the name from the DataSource, or the Resource property string for the Attachment name.

setName

public void setName(String attachmentName)
Set the name of the Attachment.
Parameters:
attachmentName - the name of the Attachment.

getEditor

public Component getEditor()
Get the editor component for the Attachment.
Returns:
the java.awt.Component editor for the given content and contentType or null if no editor can be found.

getViewer

public Component getViewer()
Get the viewer component for the Attachment.
Returns:
the java.awt.Component viewer for the given content and contentType or null if no viewer can be found.




Copyright © 2005 SAS Institute Inc. All Rights Reserved.
javadoc generated Thu, 16 Feb 2006 02:03:08