Package org.apache.james.mime4j.stream
Interface BodyDescriptorBuilder
-
- All Known Implementing Classes:
DefaultBodyDescriptorBuilder
,FallbackBodyDescriptorBuilder
public interface BodyDescriptorBuilder
Body descriptor builders are intended to construct
BodyDescriptor
instances from multiple unstructuredRawField
s.Body descriptor builders are stateful and modal as they have to store intermediate results between method invocations and also rely on a particular sequence of method invocations (the mode of operation).
Consumers are expected to interact with body descriptor builders in the following way:
- Invoke
reset()
method in order to reset builder's internal state and make it ready to start the process of building a newBodyDescriptor
. - Invoke
addField(RawField)
multiple times method in order to collect necessary details for building a body descriptor. The builder can optionally transform the unstructured field given an an input into a structured one and return an instanceField
that also implements a richer interface for a particular type of fields such asContent-Type
. The builder can also returnnull
if the field is to be ignored - Optionally invoke
newChild()
for each embedded body of content. Please note that the resultantBodyDescriptorBuilder
} child instance can inherit some its parent properties such as MIME type. - Invoke
build()
method in order to generate aBodyDescriptor
} instance based on the internal state of the builder.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Field
addField(RawField field)
Updates builder's internal state by adding a new field.BodyDescriptor
build()
Builds an instance ofBodyDescriptor
based on the internal state.BodyDescriptorBuilder
newChild()
Creates an instance ofBodyDescriptorBuilder
to be used for processing of an embedded content body.void
reset()
Resets the internal state of the builder making it ready to process new input.
-
-
-
Method Detail
-
reset
void reset()
Resets the internal state of the builder making it ready to process new input.
-
addField
Field addField(RawField field) throws MimeException
Updates builder's internal state by adding a new field. The builder can optionally transform the unstructured field given an an input into a structured one and return an instanceField
that also implements a richer interface for a particular type of fields such asContent-Type
. The builder can also returnnull
if the field is to be ignored.- Throws:
MimeException
-
build
BodyDescriptor build()
Builds an instance ofBodyDescriptor
based on the internal state.
-
newChild
BodyDescriptorBuilder newChild()
Creates an instance ofBodyDescriptorBuilder
to be used for processing of an embedded content body. Please the child instance can inherit some of its parent properties such as MIME type.
-
-