public static interface Message.PayloadBuilder
Message
's payload creation, either from a provided TypedValue
or constructing it internally from
a given value and MediaType
.PayloadBuilder#payload(TypedValue)}, {@link PayloadBuilder#value(Object)}, {@link Builder#mediaType(MediaType)}
Modifier and Type | Method and Description |
---|---|
Message.CollectionBuilder |
collectionValue(Collection value,
Class<?> itemType)
Sets the collection value for the
Message 's payload to be built. |
Message.CollectionBuilder |
collectionValue(Object[] value)
Sets the collection value for the
Message 's payload to be built. |
default Message.MapBuilder |
mapValue(Map value,
Class<?> keyType,
Class<?> valueType)
Sets the map value for the
Message 's payload to be built. |
Message.Builder |
nullValue()
Sets a
#null value for the Message 's payload to be built. |
Message.Builder |
payload(TypedValue<?> typedValue)
Sets the
Message 's TypedValue payload to be built, including it's value and media type. |
Message.CollectionBuilder |
streamValue(Iterator value,
Class<?> itemType)
Sets the consumable streaming collection value for the
Message 's payload to be built. |
Message.Builder |
value(Object value)
Sets the value for the
Message 's payload to be built. |
Message.Builder payload(TypedValue<?> typedValue)
Message
's TypedValue
payload to be built, including it's value and media type. This should be used
when you already have a TypedValue
. Alternatively, a Message
can be constructed from just the value or
value and mediaType component parts and the builder will generate the TypedValue
. See value(Object)
,
Message.Builder.mediaType(MediaType)
.
If a mediaType or value have been previously set then they will be overwritten.
typedValue
- the message payloadMessage.Builder nullValue()
#null
value for the Message
's payload to be built.Message.Builder value(Object value)
Message
's payload to be built.
If a DataType
has previously been set it's type
will be updated to reflect the type of the new
content
class while preserving it's MediaType
, unless the new content
type defines it's own
MediaType
in which case this will be used instead. See
DataTypeBuilder.fromObject(Object)
value
- the message contentMessage.CollectionBuilder streamValue(Iterator value, Class<?> itemType)
Message
's payload to be built.
If a DataType
has previously been set it's type
will be updated to reflect the type of the new
content
class while preserving it's MediaType
, unless the new value
type defines it's own
MediaType
in which case this will be used instead. See
DataTypeBuilder.fromObject(Object)
.
If you already have a Collection
instance, use collectionValue(Collection, Class)
instead.
value
- the iterator for the collection contentitemType
- the collection item typeNullPointerException
- if the payload is nullMessage.CollectionBuilder collectionValue(Collection value, Class<?> itemType)
Message
's payload to be built.
If a DataType
has previously been set it's type
will be updated to reflect the type of the new
content
class while preserving it's MediaType
, unless the new value
type defines it's own
MediaType
in which case this will be used instead. See
DataTypeBuilder.fromObject(Object)
value
- the collection contentitemType
- the collection item typeNullPointerException
- if the content is nullMessage.CollectionBuilder collectionValue(Object[] value)
Message
's payload to be built.
If a DataType
has previously been set it's type
will be updated to reflect the type of the new
content
class while preserving it's MediaType
, unless the new value
type defines it's own
MediaType
in which case this will be used instead. See
DataTypeBuilder.fromObject(Object)
value
- the array to use as a collection contentNullPointerException
- if the content is nulldefault Message.MapBuilder mapValue(Map value, Class<?> keyType, Class<?> valueType)
Message
's payload to be built.value
- the map contentkeyType
- the map's key typevalueType
- the map's value typeNullPointerException
- if the content is nullCopyright © 2018. All rights reserved.