public class MessageMLContext extends Object
MessageML document trees and converting them to output formats (PresentationML and Markdown).
To generate a messageML tree, use one of parseMessageML() or parseMarkdown(). Once the message has been parsed,
use one of the get() methods to retrieve the desired output format.| Constructor and Description |
|---|
MessageMLContext(IDataProvider dataProvider) |
| Modifier and Type | Method and Description |
|---|---|
com.fasterxml.jackson.databind.JsonNode |
getEntities()
Retrieve message entities (tags, mentions, urls) in the legacy JSON format.
|
com.fasterxml.jackson.databind.node.ObjectNode |
getEntityJson()
Retrieve a JSON representation of entity data (EntityJSON).
|
String |
getMarkdown()
Retrieve a string representation of the message in Markdown.
|
MessageML |
getMessageML()
Retrieve the MessageML document tree.
|
String |
getPresentationML()
Retrieve a string representation of the message in PresentationML.
|
void |
parseMarkdown(String message,
com.fasterxml.jackson.databind.JsonNode entities)
Parse a Markdown message into its MessageMLV2 representation.
|
void |
parseMessageML(String message,
String entityJson,
String version)
Parse the text contents of the message and optionally EntityJSON into a MessageMLV2 message.
|
public MessageMLContext(IDataProvider dataProvider)
public void parseMessageML(String message, String entityJson, String version) throws InvalidInputException, IOException, ProcessingException
message - string containing a MessageMLV2 message with optional Freemarker templatesentityJson - string containing EntityJSON dataversion - string containing the version of the message formatInvalidInputException - thrown on invalid MessageMLV2 inputProcessingException - thrown on errors generating the document treeIOException - thrown on invalid EntityJSON inputpublic void parseMarkdown(String message, com.fasterxml.jackson.databind.JsonNode entities) throws InvalidInputException
message - string containing a message in Markdownentities - additional entity data in JSONInvalidInputExceptionpublic MessageML getMessageML() throws IllegalStateException
IllegalStateException - thrown if the message hasn't been parsed yetpublic String getPresentationML() throws IllegalStateException
IllegalStateException - thrown if the message hasn't been parsed yetpublic com.fasterxml.jackson.databind.node.ObjectNode getEntityJson()
public String getMarkdown() throws IllegalStateException
IllegalStateException - thrown if the message hasn't been parsed yetpublic com.fasterxml.jackson.databind.JsonNode getEntities()
throws IllegalStateException
IllegalStateException - thrown if the message hasn't been parsed yetCopyright © 2017 The Symphony Software Foundation. All rights reserved.