- Type Parameters:
T
- the type of message
- All Known Subinterfaces:
JSONContext.Client
,JSONContextServer
- All Known Implementing Classes:
JacksonJSONContextClient
,JacksonJSONContextServer
,JettyJSONContextClient
,JettyJSONContextServer
public interface JSONContext<T extends Message.Mutable>
Abstraction for JSON parsing and generation.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
A non-blocking JSON parser.static interface
Client specificJSONContext
that binds toMessage.Mutable
.static interface
A JSON stringifier.static interface
A blocking JSON parser. -
Method Summary
Modifier and TypeMethodDescriptionConverts a single message to a JSON string.default JSONContext.AsyncParser
Parses an array of messages from the given string.
-
Method Details
-
parse
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
-
newAsyncParser
- Returns:
- a new
JSONContext.AsyncParser
instance, or null if non-blocking parsing is not supported
-
generate
-
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
-