Interface JsonLibrary
-
- All Superinterfaces:
HttpServerComponent
- All Known Implementing Classes:
Jackson2JsonLibrary
public interface JsonLibrary extends HttpServerComponent
Provides methods to support JSON features.- Since:
- 1.3
- See Also:
Jackson2JsonLibrary
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classJsonLibrary.JsonExceptionA runtime exception threw by a JSON encoder/decoder.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.lang.Class<JsonLibrary>componentType()Returns the type of the component.static JsonLibrarygetInstance()Returns the instance which implements theJsonLibrary.<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 interface com.github.fmjsjx.libnetty.http.server.component.HttpServerComponent
close, onServerClosed
-
-
-
-
Method Detail
-
getInstance
static JsonLibrary getInstance()
Returns the instance which implements theJsonLibrary.- Returns:
- the instance which implements the
JsonLibrary
-
componentType
default java.lang.Class<JsonLibrary> componentType()
Description copied from interface:HttpServerComponentReturns the type of the component.- Specified by:
componentTypein interfaceHttpServerComponent- Returns:
- the type of the component
-
read
<T> T read(io.netty.buffer.ByteBuf content, java.lang.reflect.Type valueType)Read a JSON value from the given content.- 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
io.netty.buffer.ByteBuf write(io.netty.buffer.ByteBufAllocator alloc, java.lang.Object value)Write a JSON value into the aByteBuf.- Parameters:
alloc- theByteBufAllocatorallocatesByteBufsvalue- the value object- Returns:
- a
ByteBuf
-
-