Package 

Interface JsonMapper

  • All Implemented Interfaces:

    
    public interface JsonMapper
    
                        
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      String toJsonString(@NotNull() Object obj) Javalin uses this method for json, as well as the CookieStore class, WebSockets messaging, and JavalinVue.
      InputStream toJsonStream(@NotNull() Object obj) Javalin uses this method for json, if called with useStreamingMapper = true.
      <T> T fromJsonString(@NotNull() String json, @NotNull() Class<T> targetClass) If fromJsonStream is not implemented, Javalin will use this method when mapping request bodies to JSON through bodyAsClass.
      <T> T fromJsonStream(@NotNull() InputStream json, @NotNull() Class<T> targetClass) If implemented, Javalin will use this method instead of fromJsonString when mapping request bodies to JSON through bodyAsClass.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • toJsonString

        @NotNull() String toJsonString(@NotNull() Object obj)

        Javalin uses this method for json, as well as the CookieStore class, WebSockets messaging, and JavalinVue.

      • toJsonStream

        @NotNull() InputStream toJsonStream(@NotNull() Object obj)

        Javalin uses this method for json, if called with useStreamingMapper = true. When implementing this method, use (or look at) PipedStreamUtil to get an InputStream from an OutputStream.

      • fromJsonString

        @NotNull() <T> T fromJsonString(@NotNull() String json, @NotNull() Class<T> targetClass)

        If fromJsonStream is not implemented, Javalin will use this method when mapping request bodies to JSON through bodyAsClass. Regardless of if fromJsonStream is implemented, Javalin will use this method for Validation and for WebSocket messaging.

      • fromJsonStream

        @NotNull() <T> T fromJsonStream(@NotNull() InputStream json, @NotNull() Class<T> targetClass)

        If implemented, Javalin will use this method instead of fromJsonString when mapping request bodies to JSON through bodyAsClass.