Class Jackson2JsonLibrary
- java.lang.Object
-
- com.github.fmjsjx.libnetty.http.server.component.Jackson2JsonLibrary
-
- All Implemented Interfaces:
HttpServerComponent,JsonLibrary
public class Jackson2JsonLibrary extends java.lang.Object implements JsonLibrary
Implementation ofJsonLibraryusingjackson2.- Since:
- 1.3
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.github.fmjsjx.libnetty.http.server.component.JsonLibrary
JsonLibrary.JsonException
-
-
Constructor Summary
Constructors Constructor Description Jackson2JsonLibrary()Constructs a newJackson2JsonLibrarywith the defaultObjectMapper.Jackson2JsonLibrary(com.fasterxml.jackson.databind.ObjectMapper objectMapper)Constructs a newJackson2JsonLibrarywith the specifiedObjectMapper.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static com.fasterxml.jackson.databind.ObjectMapperdefaultObjectMapper()static com.fasterxml.jackson.databind.ModulejavaTimeModule()static booleanjavaTimeModuleEnabled()static com.fasterxml.jackson.databind.Modulejdk8Module()static booleanjdk8ModuleEnabled()<T> Tread(io.netty.buffer.ByteBuf content, java.lang.reflect.Type valueType)Read a JSON value from the given content.io.netty.buffer.ByteBufwrite(io.netty.buffer.ByteBufAllocator alloc, java.lang.Object value)Write a JSON value into the aByteBuf.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.fmjsjx.libnetty.http.server.component.HttpServerComponent
close, onServerClosed
-
Methods inherited from interface com.github.fmjsjx.libnetty.http.server.component.JsonLibrary
componentType
-
-
-
-
Constructor Detail
-
Jackson2JsonLibrary
public Jackson2JsonLibrary(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
Constructs a newJackson2JsonLibrarywith the specifiedObjectMapper.- Parameters:
objectMapper- anObjectMapper
-
Jackson2JsonLibrary
public Jackson2JsonLibrary()
Constructs a newJackson2JsonLibrarywith the defaultObjectMapper.
-
-
Method Detail
-
defaultObjectMapper
public static final com.fasterxml.jackson.databind.ObjectMapper defaultObjectMapper()
-
jdk8ModuleEnabled
public static final boolean jdk8ModuleEnabled()
-
jdk8Module
public static final com.fasterxml.jackson.databind.Module jdk8Module()
-
javaTimeModuleEnabled
public static final boolean javaTimeModuleEnabled()
-
javaTimeModule
public static final com.fasterxml.jackson.databind.Module javaTimeModule()
-
read
public <T> T read(io.netty.buffer.ByteBuf content, java.lang.reflect.Type valueType)Description copied from interface:JsonLibraryRead a JSON value from the given content.- Specified by:
readin interfaceJsonLibrary- Type Parameters:
T- the type of the value to be converted to- Parameters:
content- aByteBufvalueType- the common type of the value- Returns:
- the converted object
-
write
public io.netty.buffer.ByteBuf write(io.netty.buffer.ByteBufAllocator alloc, java.lang.Object value)Description copied from interface:JsonLibraryWrite a JSON value into the aByteBuf.- Specified by:
writein interfaceJsonLibrary- Parameters:
alloc- theByteBufAllocatorallocatesByteBufsvalue- the value object- Returns:
- a
ByteBuf
-
-