Class JacksonDatabindMapper

  • All Implemented Interfaces:
    io.micronaut.json.JsonMapper

    @Internal
    @Singleton
    public final class JacksonDatabindMapper
    extends java.lang.Object
    implements io.micronaut.json.JsonMapper
    jackson-databind implementation of JsonMapper.
    Since:
    3.1
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      io.micronaut.json.JsonMapper cloneWithFeatures​(io.micronaut.json.JsonFeatures features)  
      io.micronaut.json.JsonMapper cloneWithViewClass​(java.lang.Class<?> viewClass)  
      org.reactivestreams.Processor<byte[],​io.micronaut.json.tree.JsonNode> createReactiveParser​(java.util.function.Consumer<org.reactivestreams.Processor<byte[],​io.micronaut.json.tree.JsonNode>> onSubscribe, boolean streamArray)  
      java.util.Optional<io.micronaut.json.JsonFeatures> detectFeatures​(io.micronaut.core.annotation.AnnotationMetadata annotations)  
      com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()  
      io.micronaut.json.JsonStreamConfig getStreamConfig()  
      <T> T readValue​(byte[] byteArray, io.micronaut.core.type.Argument<T> type)  
      <T> T readValue​(java.io.InputStream inputStream, io.micronaut.core.type.Argument<T> type)  
      <T> T readValueFromTree​(io.micronaut.json.tree.JsonNode tree, io.micronaut.core.type.Argument<T> type)  
      void updateValueFromTree​(java.lang.Object value, io.micronaut.json.tree.JsonNode tree)  
      <T> void writeValue​(java.io.OutputStream outputStream, io.micronaut.core.type.Argument<T> type, T object)  
      void writeValue​(java.io.OutputStream outputStream, java.lang.Object object)  
      <T> byte[] writeValueAsBytes​(io.micronaut.core.type.Argument<T> type, T object)  
      byte[] writeValueAsBytes​(java.lang.Object object)  
      <T> io.micronaut.json.tree.JsonNode writeValueToTree​(io.micronaut.core.type.Argument<T> type, T value)  
      io.micronaut.json.tree.JsonNode writeValueToTree​(java.lang.Object value)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.micronaut.json.JsonMapper

        readValue, readValueFromTree
    • Constructor Detail

      • JacksonDatabindMapper

        @Inject
        @Internal
        public JacksonDatabindMapper​(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      • JacksonDatabindMapper

        @Internal
        public JacksonDatabindMapper()
    • Method Detail

      • getObjectMapper

        @Internal
        public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
      • readValueFromTree

        public <T> T readValueFromTree​(@NonNull
                                       io.micronaut.json.tree.JsonNode tree,
                                       @NonNull
                                       io.micronaut.core.type.Argument<T> type)
                                throws java.io.IOException
        Specified by:
        readValueFromTree in interface io.micronaut.json.JsonMapper
        Throws:
        java.io.IOException
      • writeValueToTree

        @NonNull
        public io.micronaut.json.tree.JsonNode writeValueToTree​(@Nullable
                                                                java.lang.Object value)
                                                         throws java.io.IOException
        Specified by:
        writeValueToTree in interface io.micronaut.json.JsonMapper
        Throws:
        java.io.IOException
      • writeValueToTree

        @NonNull
        public <T> io.micronaut.json.tree.JsonNode writeValueToTree​(@NonNull
                                                                    io.micronaut.core.type.Argument<T> type,
                                                                    T value)
                                                             throws java.io.IOException
        Specified by:
        writeValueToTree in interface io.micronaut.json.JsonMapper
        Throws:
        java.io.IOException
      • readValue

        public <T> T readValue​(@NonNull
                               java.io.InputStream inputStream,
                               @NonNull
                               io.micronaut.core.type.Argument<T> type)
                        throws java.io.IOException
        Specified by:
        readValue in interface io.micronaut.json.JsonMapper
        Throws:
        java.io.IOException
      • readValue

        public <T> T readValue​(@NonNull
                               byte[] byteArray,
                               @NonNull
                               io.micronaut.core.type.Argument<T> type)
                        throws java.io.IOException
        Specified by:
        readValue in interface io.micronaut.json.JsonMapper
        Throws:
        java.io.IOException
      • writeValue

        public void writeValue​(@NonNull
                               java.io.OutputStream outputStream,
                               @Nullable
                               java.lang.Object object)
                        throws java.io.IOException
        Specified by:
        writeValue in interface io.micronaut.json.JsonMapper
        Throws:
        java.io.IOException
      • writeValue

        public <T> void writeValue​(@NonNull
                                   java.io.OutputStream outputStream,
                                   @NonNull
                                   io.micronaut.core.type.Argument<T> type,
                                   T object)
                            throws java.io.IOException
        Specified by:
        writeValue in interface io.micronaut.json.JsonMapper
        Throws:
        java.io.IOException
      • writeValueAsBytes

        public byte[] writeValueAsBytes​(@Nullable
                                        java.lang.Object object)
                                 throws java.io.IOException
        Specified by:
        writeValueAsBytes in interface io.micronaut.json.JsonMapper
        Throws:
        java.io.IOException
      • writeValueAsBytes

        public <T> byte[] writeValueAsBytes​(@NonNull
                                            io.micronaut.core.type.Argument<T> type,
                                            T object)
                                     throws java.io.IOException
        Specified by:
        writeValueAsBytes in interface io.micronaut.json.JsonMapper
        Throws:
        java.io.IOException
      • updateValueFromTree

        public void updateValueFromTree​(java.lang.Object value,
                                        @NonNull
                                        io.micronaut.json.tree.JsonNode tree)
                                 throws java.io.IOException
        Specified by:
        updateValueFromTree in interface io.micronaut.json.JsonMapper
        Throws:
        java.io.IOException
      • cloneWithFeatures

        @NonNull
        public io.micronaut.json.JsonMapper cloneWithFeatures​(@NonNull
                                                              io.micronaut.json.JsonFeatures features)
        Specified by:
        cloneWithFeatures in interface io.micronaut.json.JsonMapper
      • cloneWithViewClass

        @NonNull
        public io.micronaut.json.JsonMapper cloneWithViewClass​(@NonNull
                                                               java.lang.Class<?> viewClass)
        Specified by:
        cloneWithViewClass in interface io.micronaut.json.JsonMapper
      • getStreamConfig

        @NonNull
        public io.micronaut.json.JsonStreamConfig getStreamConfig()
        Specified by:
        getStreamConfig in interface io.micronaut.json.JsonMapper
      • createReactiveParser

        @NonNull
        public org.reactivestreams.Processor<byte[],​io.micronaut.json.tree.JsonNode> createReactiveParser​(@NonNull
                                                                                                                java.util.function.Consumer<org.reactivestreams.Processor<byte[],​io.micronaut.json.tree.JsonNode>> onSubscribe,
                                                                                                                boolean streamArray)
        Specified by:
        createReactiveParser in interface io.micronaut.json.JsonMapper
      • detectFeatures

        @NonNull
        public java.util.Optional<io.micronaut.json.JsonFeatures> detectFeatures​(@NonNull
                                                                                 io.micronaut.core.annotation.AnnotationMetadata annotations)
        Specified by:
        detectFeatures in interface io.micronaut.json.JsonMapper