class MessageContentExtractor {

    public MessageContent extract(org.apache.james.mime4j.dom.Message message) throws IOException {
        Body body = message.getBody();
        if (body instanceof TextBody) {
            return parseTextBody(message, (TextBody)body);
        }
        if (body instanceof Multipart) {
            return parseMultipart(message, (Multipart)body);
        }
        return MessageContent.empty();
    }

}