public class JsonPayloadUtil extends Object
Modifier and Type | Method and Description |
---|---|
static Payload |
toPayload(Object obj)
Creates a new payload that will use a default
ObjectMapper to
write the provided object to an OutputStream using
#writeTo(OutputStream) . |
static Payload |
toPayload(Object obj,
ObjectMapper mapper)
Creates a new payload that will using the provided
ObjectMapper
to write the provided object to an OutputStream using
#writeTo(OutputStream) . |
static Payload |
toPayload(TreeNode node)
Creates a new payload that will use a default
ObjectMapper to
write the provided TreeNode to an OutputStream using
#writeTo(OutputStream) . |
public static Payload toPayload(Object obj)
ObjectMapper
to
write the provided object to an OutputStream
using
#writeTo(OutputStream)
. The ObjectMapper
used by this
method does not allow access modifiers to be overridden and will not fail
when writing empty beans.obj
- the object to writenull
, null
otherwisepublic static Payload toPayload(Object obj, ObjectMapper mapper)
ObjectMapper
to write the provided object to an OutputStream
using
#writeTo(OutputStream)
.obj
- the object to writemapper
- the mapper used to write the objectnull
, null
otherwisepublic static Payload toPayload(TreeNode node)
ObjectMapper
to
write the provided TreeNode
to an OutputStream
using
#writeTo(OutputStream)
. The ObjectMapper
used by this
method does not allow access modifiers to be overridden and will not fail
when writing empty beans.node
- the object to writenull
, null
otherwise