org.apache.james.mime4j.field
Class Field

java.lang.Object
  extended by org.apache.james.mime4j.field.Field
Direct Known Subclasses:
AddressListField, ContentTransferEncodingField, ContentTypeField, DateTimeField, MailboxField, MailboxListField, UnstructuredField

public abstract class Field
extends java.lang.Object

The base class of all field classes.

Version:
$Id: Field.java,v 1.6 2004/10/25 07:26:46 ntherning Exp $

Field Summary
static java.lang.String BCC
           
static java.lang.String CC
           
static java.lang.String CONTENT_TRANSFER_ENCODING
           
static java.lang.String CONTENT_TYPE
           
static java.lang.String DATE
           
static java.lang.String FROM
           
static java.lang.String REPLY_TO
           
static java.lang.String RESENT_BCC
           
static java.lang.String RESENT_CC
           
static java.lang.String RESENT_DATE
           
static java.lang.String RESENT_FROM
           
static java.lang.String RESENT_SENDER
           
static java.lang.String RESENT_TO
           
static java.lang.String SENDER
           
static java.lang.String SUBJECT
           
static java.lang.String TO
           
 
Constructor Summary
protected Field(java.lang.String name, java.lang.String body, java.lang.String raw)
           
 
Method Summary
 java.lang.String getBody()
          Gets the unfolded, unparsed and possibly encoded (see RFC 2047) field body string.
 java.lang.String getName()
          Gets the name of the field (Subject, From, etc).
static DefaultFieldParser getParser()
          Gets the default parser used to parse fields.
 java.lang.String getRaw()
          Gets the original raw field string.
 boolean isContentType()
          Determines if this is a Content-Type field.
 boolean isFrom()
          Determines if this is a From field.
 boolean isSubject()
          Determines if this is a Subject field.
 boolean isTo()
          Determines if this is a To field.
static Field parse(java.lang.String raw)
          Parses the given string and returns an instance of the Field class.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SENDER

public static final java.lang.String SENDER
See Also:
Constant Field Values

FROM

public static final java.lang.String FROM
See Also:
Constant Field Values

TO

public static final java.lang.String TO
See Also:
Constant Field Values

CC

public static final java.lang.String CC
See Also:
Constant Field Values

BCC

public static final java.lang.String BCC
See Also:
Constant Field Values

REPLY_TO

public static final java.lang.String REPLY_TO
See Also:
Constant Field Values

RESENT_SENDER

public static final java.lang.String RESENT_SENDER
See Also:
Constant Field Values

RESENT_FROM

public static final java.lang.String RESENT_FROM
See Also:
Constant Field Values

RESENT_TO

public static final java.lang.String RESENT_TO
See Also:
Constant Field Values

RESENT_CC

public static final java.lang.String RESENT_CC
See Also:
Constant Field Values

RESENT_BCC

public static final java.lang.String RESENT_BCC
See Also:
Constant Field Values

DATE

public static final java.lang.String DATE
See Also:
Constant Field Values

RESENT_DATE

public static final java.lang.String RESENT_DATE
See Also:
Constant Field Values

SUBJECT

public static final java.lang.String SUBJECT
See Also:
Constant Field Values

CONTENT_TYPE

public static final java.lang.String CONTENT_TYPE
See Also:
Constant Field Values

CONTENT_TRANSFER_ENCODING

public static final java.lang.String CONTENT_TRANSFER_ENCODING
See Also:
Constant Field Values
Constructor Detail

Field

protected Field(java.lang.String name,
                java.lang.String body,
                java.lang.String raw)
Method Detail

parse

public static Field parse(java.lang.String raw)
Parses the given string and returns an instance of the Field class. The type of the class returned depends on the field name:
Field nameClass returned Content-Typeorg.apache.james.mime4j.field.ContentTypeField otherorg.apache.james.mime4j.field.UnstructuredField

Parameters:
s - the string to parse.
Returns:
a Field instance.
Throws:
java.lang.IllegalArgumentException - on parse errors.

getParser

public static DefaultFieldParser getParser()
Gets the default parser used to parse fields.

Returns:
the default field parser

getName

public java.lang.String getName()
Gets the name of the field (Subject, From, etc).

Returns:
the field name.

getRaw

public java.lang.String getRaw()
Gets the original raw field string.

Returns:
the original raw field string.

getBody

public java.lang.String getBody()
Gets the unfolded, unparsed and possibly encoded (see RFC 2047) field body string.

Returns:
the unfolded unparsed field body string.

isContentType

public boolean isContentType()
Determines if this is a Content-Type field.

Returns:
true if this is a Content-Type field, false otherwise.

isSubject

public boolean isSubject()
Determines if this is a Subject field.

Returns:
true if this is a Subject field, false otherwise.

isFrom

public boolean isFrom()
Determines if this is a From field.

Returns:
true if this is a From field, false otherwise.

isTo

public boolean isTo()
Determines if this is a To field.

Returns:
true if this is a To field, false otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
getRaw()


Copyright © 2004-2008 The Apache Software Foundation. All Rights Reserved.