public class FieldPathPayloadSubsectionExtractor extends 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(String fieldPath)
Creates a new
FieldPathPayloadSubsectionExtractor that will extract the
subsection of the JSON payload found at the given fieldPath . |
protected |
FieldPathPayloadSubsectionExtractor(String fieldPath,
String subsectionId)
Creates a new
FieldPathPayloadSubsectionExtractor that will extract the
subsection of the JSON payload found at the given fieldPath and that will
us 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 String |
getFieldPath()
Returns the path of the field that will be extracted.
|
String |
getSubsectionId()
Returns an identifier for the subsection that this extractor will extract.
|
FieldPathPayloadSubsectionExtractor |
withSubsectionId(String subsectionId)
Returns an extractor with the given
subsectionId . |
protected FieldPathPayloadSubsectionExtractor(String fieldPath)
FieldPathPayloadSubsectionExtractor
that will extract the
subsection of the JSON payload found at the given fieldPath
. The
fieldPath
prefixed with beneath-
with be used as the subsection ID.fieldPath
- the path of the fieldprotected FieldPathPayloadSubsectionExtractor(String fieldPath, String subsectionId)
FieldPathPayloadSubsectionExtractor
that will extract the
subsection of the JSON payload found at the given fieldPath
and that will
us 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 String getSubsectionId()
PayloadSubsectionExtractor
getSubsectionId
in interface PayloadSubsectionExtractor<FieldPathPayloadSubsectionExtractor>
protected String getFieldPath()
public FieldPathPayloadSubsectionExtractor withSubsectionId(String subsectionId)
PayloadSubsectionExtractor
subsectionId
.withSubsectionId
in interface PayloadSubsectionExtractor<FieldPathPayloadSubsectionExtractor>
subsectionId
- the subsection ID