Message.RecipientType (Java EE 5)

Java EE API


javax.mail Class Message.RecipientType

java.lang.Object
  extended by javax.mail.Message.RecipientType
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
MimeMessage.RecipientType
Enclosing class:
Message

public static class Message.RecipientType
extends Object
implements Serializable

Implements: java.io.Serializable
Contained within: Message

此内部类定义了 Message 类所允许的接收方类型。目前已定义的类型有 TO、CC 和 BCC。 注意,此类只有一个受保护的构造方法,因此新的 Recipient 类型被限制为此类或其子类。这有效实现了所允许 Recipient 类型的枚举。 以下代码示例显示了如何使用此类从消息中获取 "TO" 接收方。
Message msg = folder.getMessages(1);
Address[] a = m.getRecipients(Message.RecipientType.TO);

 

英文文档:

This inner class defines the types of recipients allowed by the Message class. The currently defined types are TO, CC and BCC. Note that this class only has a protected constructor, thereby restricting new Recipient types to either this class or subclasses. This effectively implements an enumeration of the allowed Recipient types. The following code sample shows how to use this class to obtain the "TO" recipients from a message.

 Message msg = folder.getMessages(1);
 Address[] a = m.getRecipients(Message.RecipientType.TO);

 

See Also:
Message.getRecipients(javax.mail.Message.RecipientType), Message.setRecipients(javax.mail.Message.RecipientType, javax.mail.Address[]), Message.addRecipients(javax.mail.Message.RecipientType, javax.mail.Address[]), Serialized Form

Field Summary
static Message.RecipientType
static Message.RecipientType
static Message.RecipientType
protected  String
 
Constructor Summary
protected
 
Method Summary
protected  Object
 String
 
Methods inherited from class java.lang.Object
 

Field Detail

英文文档:

TO

public static final Message.RecipientType TO
The "To" (primary) recipients.


英文文档:

CC

public static final Message.RecipientType CC
The "Cc" (carbon copy) recipients.


英文文档:

BCC

public static final Message.RecipientType BCC
The "Bcc" (blind carbon copy) recipients.


英文文档:

type

protected String type
The type of recipient, usually the name of a corresponding Internet standard header.

Constructor Detail

protected Message.RecipientType(String type)
子类使用的构造方法。
英文文档:

Message.RecipientType

protected Message.RecipientType(String type)
Constructor for use by subclasses.

Method Detail

protected Object readResolve() throws java.io.ObjectStreamException
反序列化 RecipientType 时,我们需要确保仅返回此类中定义的已知静态最终实例之一。子类必须实现自己的 readResolve 方法,以便在调用此超类方法前检查已知的实例。
英文文档:

readResolve

protected Object readResolve()
                      throws ObjectStreamException
When deserializing a RecipientType, we need to make sure to return only one of the known static final instances defined in this class. Subclasses must implement their own readResolve method that checks for their known instances before calling this super method.

Throws:
ObjectStreamException

public String toString()
英文文档:

toString

public String toString()
Overrides:
toString in class Object


Submit a bug or feature

Copyright 2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.

一看就知道只有菜鸟才干这么无知的事啦。

PS : 未经我党受权你也可自由散发此文档。 如有任何错误请自行修正;若因此而造成任何损失请直接找人民主席,请勿与本人联系。谢谢!