public class FieldPathPayloadSubsectionExtractor extends java.lang.Object implements PayloadSubsectionExtractor<FieldPathPayloadSubsectionExtractor>
PayloadSubsectionExtractor
that extracts the subsection of the JSON payload
identified by a field path.PayloadDocumentation.beneathPath(String)
Modifier | Constructor and Description |
---|---|
protected |
FieldPathPayloadSubsectionExtractor(java.lang.String fieldPath)
Creates a new
FieldPathPayloadSubsectionExtractor that will extract the
subsection of the JSON payload beneath the given fieldPath . |
protected |
FieldPathPayloadSubsectionExtractor(java.lang.String fieldPath,
java.lang.String subsectionId)
Creates a new
FieldPathPayloadSubsectionExtractor that will extract the
subsection of the JSON payload beneath the given fieldPath and that will
use the given subsectionId to identify the subsection. |
Modifier and Type | Method and Description |
---|---|
byte[] |
extractSubsection(byte[] payload,
org.springframework.http.MediaType contentType)
Extracts a subsection of the given
payload that has the given
contentType . |
protected java.lang.String |
getFieldPath()
Returns the path of the field that will be extracted.
|
java.lang.String |
getSubsectionId()
Returns an identifier for the subsection that this extractor will extract.
|
FieldPathPayloadSubsectionExtractor |
withSubsectionId(java.lang.String subsectionId)
Returns an extractor with the given
subsectionId . |
protected FieldPathPayloadSubsectionExtractor(java.lang.String fieldPath)
FieldPathPayloadSubsectionExtractor
that will extract the
subsection of the JSON payload beneath the given fieldPath
. The
fieldPath
prefixed with beneath-
with be used as the subsection ID.fieldPath
- the path of the fieldprotected FieldPathPayloadSubsectionExtractor(java.lang.String fieldPath, java.lang.String subsectionId)
FieldPathPayloadSubsectionExtractor
that will extract the
subsection of the JSON payload beneath the given fieldPath
and that will
use the given subsectionId
to identify the subsection.fieldPath
- the path of the fieldsubsectionId
- the ID of the subsectionpublic byte[] extractSubsection(byte[] payload, org.springframework.http.MediaType contentType)
PayloadSubsectionExtractor
payload
that has the given
contentType
.extractSubsection
in interface PayloadSubsectionExtractor<FieldPathPayloadSubsectionExtractor>
payload
- the payloadcontentType
- the content type of the payloadpublic java.lang.String getSubsectionId()
PayloadSubsectionExtractor
getSubsectionId
in interface PayloadSubsectionExtractor<FieldPathPayloadSubsectionExtractor>
protected java.lang.String getFieldPath()
public FieldPathPayloadSubsectionExtractor withSubsectionId(java.lang.String subsectionId)
PayloadSubsectionExtractor
subsectionId
.withSubsectionId
in interface PayloadSubsectionExtractor<FieldPathPayloadSubsectionExtractor>
subsectionId
- the subsection ID