public abstract class AbstractEntityBuilder extends Object
Constructor and Description |
---|
AbstractEntityBuilder() |
Modifier and Type | Method and Description |
---|---|
AbstractEntityBuilder |
addField(Field field)
Adds a field to the end of the list of fields.
|
AbstractEntityBuilder |
clearFields()
Clears all fields.
|
boolean |
containsField(String name)
Returns
true if there is at least one explicitly
set field with the given name. |
Body |
getBody()
Returns message body.
|
String |
getCharset()
Returns MIME character set encoding of this message.
|
String |
getContentTransferEncoding()
Returns transfer encoding of this message.
|
Date |
getCreationDate()
Returns creation date of the content disposition of this message.
|
String |
getDispositionType()
Return disposition type of this message.
|
Field |
getField(String name)
Gets a
Field given a field name. |
<F extends Field> |
getField(String name,
Class<F> clazz)
Gets a
Field given a field name and of the given type. |
List<Field> |
getFields()
Gets the fields of this header.
|
List<Field> |
getFields(String name)
Gets all
Field s having the specified field name. |
<F extends Field> |
getFields(String name,
Class<F> clazz)
Gets all
Field s having the specified field name
and of the given type. |
String |
getFilename()
Returns filename of the content disposition of this message.
|
String |
getMimeType()
Returns MIME type of this message.
|
Date |
getModificationDate()
Returns modification date of the content disposition of this message.
|
Date |
getReadDate()
Returns read date of the content disposition of this message.
|
long |
getSize()
Returns size of the content disposition of this message.
|
<F extends ParsedField> |
obtainField(String fieldName) |
AbstractEntityBuilder |
removeFields(String name)
Removes all
Field s having the specified field name. |
AbstractEntityBuilder |
setBody(BinaryBody binaryBody)
Sets binaryBody of this message.
|
AbstractEntityBuilder |
setBody(Body body)
Sets body of this message.
|
AbstractEntityBuilder |
setBody(Message.Builder message) |
AbstractEntityBuilder |
setBody(Message message)
Sets body of this message.
|
AbstractEntityBuilder |
setBody(Multipart multipart)
Sets body of this message.
|
AbstractEntityBuilder |
setBody(MultipartBuilder multipart) |
AbstractEntityBuilder |
setBody(SingleBodyBuilder body) |
AbstractEntityBuilder |
setBody(TextBody textBody)
Sets body of this message.
|
AbstractEntityBuilder |
setContentDisposition(String dispositionType)
Sets content disposition of this message to the
specified disposition type.
|
AbstractEntityBuilder |
setContentDisposition(String dispositionType,
String filename)
Sets content disposition of this message to the
specified disposition type and filename.
|
AbstractEntityBuilder |
setContentDisposition(String dispositionType,
String filename,
long size)
Sets content disposition of this message to the
specified values.
|
AbstractEntityBuilder |
setContentDisposition(String dispositionType,
String filename,
long size,
Date creationDate,
Date modificationDate,
Date readDate)
Sets content disposition of this message to the
specified values.
|
AbstractEntityBuilder |
setContentTransferEncoding(String contentTransferEncoding)
Sets transfer encoding of this message.
|
AbstractEntityBuilder |
setContentType(String mimeType,
NameValuePair... parameters)
Sets transfer encoding of this message.
|
AbstractEntityBuilder |
setField(Field field)
Sets or replaces a field.
|
public AbstractEntityBuilder addField(Field field)
field
- the field to add.public List<Field> getFields()
Field
objects.public Field getField(String name)
Field
given a field name. If there are multiple
such fields defined in this header the first one will be returned.name
- the field name (e.g. From, Subject).null
if none found.public <F extends Field> F getField(String name, Class<F> clazz)
Field
given a field name and of the given type.
If there are multiple such fields defined in this header the first
one will be returned.name
- the field name (e.g. From, Subject).clazz
- the field class.null
if none found.public boolean containsField(String name)
true
if there is at least one explicitly
set field with the given name.name
- the field name (e.g. From, Subject).true
if there is at least one explicitly
set field with the given name, false
otherwise.public List<Field> getFields(String name)
Field
s having the specified field name.name
- the field name (e.g. From, Subject).public <F extends Field> List<F> getFields(String name, Class<F> clazz)
Field
s having the specified field name
and of the given type.name
- the field name (e.g. From, Subject).clazz
- the field class.public AbstractEntityBuilder removeFields(String name)
Field
s having the specified field name.name
- the field name (e.g. From, Subject).public AbstractEntityBuilder setField(Field field)
addField(org.apache.james.mime4j.stream.Field)
). Otherwise the
first occurrence of a field with the same name is replaced by the given
field and all further occurrences are removed.field
- the field to set.public AbstractEntityBuilder clearFields()
public <F extends ParsedField> F obtainField(String fieldName)
public String getMimeType()
null
if no MIME
type has been set.public String getCharset()
null
if no charset
type has been set.public AbstractEntityBuilder setContentType(String mimeType, NameValuePair... parameters)
mimeType
- MIME type of this message
the MIME type to use.parameters
- content type parameters to use.public String getContentTransferEncoding()
public AbstractEntityBuilder setContentTransferEncoding(String contentTransferEncoding)
contentTransferEncoding
- transfer encoding to use.public String getDispositionType()
null
if no disposition
type has been set.public AbstractEntityBuilder setContentDisposition(String dispositionType)
dispositionType
- disposition type value (usually inline
or
attachment
).public AbstractEntityBuilder setContentDisposition(String dispositionType, String filename)
dispositionType
- disposition type value (usually inline
or
attachment
).filename
- filename parameter value or null
if the
parameter should not be included.public AbstractEntityBuilder setContentDisposition(String dispositionType, String filename, long size)
dispositionType
- disposition type value (usually inline
or
attachment
).filename
- filename parameter value or null
if the
parameter should not be included.size
- size parameter value or -1
if the parameter
should not be included.public AbstractEntityBuilder setContentDisposition(String dispositionType, String filename, long size, Date creationDate, Date modificationDate, Date readDate)
dispositionType
- disposition type value (usually inline
or
attachment
).filename
- filename parameter value or null
if the
parameter should not be included.size
- size parameter value or -1
if the parameter
should not be included.creationDate
- creation-date parameter value or null
if the
parameter should not be included.modificationDate
- modification-date parameter value or null
if
the parameter should not be included.readDate
- read-date parameter value or null
if the
parameter should not be included.public String getFilename()
null
if the filename has not been set.public long getSize()
-1
if the filename has not been set.public Date getCreationDate()
null
if the filename has not been set.public Date getModificationDate()
null
if the filename has not been set.public Date getReadDate()
null
if the filename has not been set.public AbstractEntityBuilder setBody(Body body)
Body
.body
- the body.public AbstractEntityBuilder setBody(SingleBodyBuilder body) throws IOException
IOException
public AbstractEntityBuilder setBody(TextBody textBody)
Body
.textBody
- the body.public AbstractEntityBuilder setBody(BinaryBody binaryBody)
Body
.binaryBody
- the binaryBody.public AbstractEntityBuilder setBody(Message message)
Message
.message
- the body.public AbstractEntityBuilder setBody(Message.Builder message)
public AbstractEntityBuilder setBody(Multipart multipart)
Multipart
.multipart
- the body.public AbstractEntityBuilder setBody(MultipartBuilder multipart)
public Body getBody()
Copyright © 2004–2023 The Apache Software Foundation. All rights reserved.