Class XJmfMessage

java.lang.Object
org.cip4.lib.xjdf.XJmfMessage

public class XJmfMessage extends Object
This class provides functionality all about XJMF Messages.
  • Constructor Details

    • XJmfMessage

      public XJmfMessage()
      Default constructor.
      Creates an XJMF Message initialized with default values.
    • XJmfMessage

      public XJmfMessage(byte[] bytes) throws XJdfParseException
      Custom Constructor.
      Accepting an XJMF Message as byte array for initializing.
      Parameters:
      bytes - The XJMF Message as byte array.
      Throws:
      XJdfParseException
    • XJmfMessage

      public XJmfMessage(XJMF xjmf)
      Custom Constructor.
      Accepting an XJMF root node for initializing.
      Parameters:
      xjmf - The XJMF root node.
  • Method Details

    • getXJmf

      public XJMF getXJmf()
      Returns the XJMF Messages XJMF root node.
      Returns:
      The XJMF root node.
    • addMessage

      public void addMessage(@NotNull @NotNull Message message)
      Add a specific to the XJMF Message object.
      Parameters:
      message - The message to be added. NOTE: If no header is present, a default one will be created.
    • getMessage

      public <T extends Message> T getMessage(Class<T> type) throws XJmfMessageException
      Return the typed message in the XJMF body.
      Parameters:
      type - The message's type.
      Returns:
      The typed message.
      Throws:
      XJmfMessageException
    • getMessages

      public List<Message> getMessages()
      Return the list of all specific messages contained by this XJMF Message.
      Returns:
      List of specific messages.
    • toXml

      public byte[] toXml() throws XJdfParseException, XJdfValidationException
      Returns the current XJMF Message as XML byte array.
      Returns:
      The XJDF Document as XML byte array.
      Throws:
      XJdfParseException
      XJdfValidationException
    • toXml

      public byte[] toXml(boolean validate) throws XJdfParseException, XJdfValidationException
      Returns the current XJDF Document as XML byte array.
      Parameters:
      validate - 'false' in case validation should be skipped.
      Returns:
      The XJDF Document as XML byte array.
      Throws:
      XJdfParseException
      XJdfValidationException
    • toString

      public String toString()
      Overrides:
      toString in class Object