Interface JSONContext<T extends org.cometd.bayeux.Message.Mutable>

    • Method Detail

      • parse

        T[] parse​(Reader reader)
           throws ParseException

        Parses an array of messages from the given reader.

        Parameters:
        reader - the reader to parse from
        Returns:
        an array of messages
        Throws:
        ParseException - in case of parsing errors
      • parse

        T[] parse​(String json)
           throws ParseException

        Parses an array of messages from the given string.

        Parameters:
        json - the JSON string to parse from
        Returns:
        an array of messages
        Throws:
        ParseException - in case of parsing errors
      • generate

        String generate​(T message)

        Converts a single message to a JSON string.

        Parameters:
        message - the message to stringify
        Returns:
        the JSON string for the message
      • generate

        String generate​(List<T> messages)

        Converts a list of messages to a JSON string.

        Parameters:
        messages - the list of messages to stringify
        Returns:
        the JSON string for the messages
      • getParser

        JSONContext.Parser getParser()
        Returns:
        a synchronous JSON parser to parse any JSON string
      • getGenerator

        JSONContext.Generator getGenerator()
        Returns:
        a JSON generator to stringify any object to a JSON string