Class JsonRecordSeparatorPolicy
java.lang.Object
org.springframework.batch.item.file.separator.SimpleRecordSeparatorPolicy
org.springframework.batch.item.file.separator.JsonRecordSeparatorPolicy
- All Implemented Interfaces:
RecordSeparatorPolicy
JSON-based record separator. Waits for a valid JSON object before returning a complete
line. A valid object has balanced braces ({}), possibly nested, and ends with a closing
brace. This separator can be used to split a stream into JSON objects, even if those
objects are spread over multiple lines, e.g.
{"foo": "bar",
"value": { "spam": 2 }}
{"foo": "rab",
"value": { "spam": 3, "foo": "bar" }}
- Author:
- Dave Syer
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisEndOfRecord(String line) True if the line can be parsed to a JSON object.Methods inherited from class org.springframework.batch.item.file.separator.SimpleRecordSeparatorPolicy
postProcess, preProcess
-
Constructor Details
-
JsonRecordSeparatorPolicy
public JsonRecordSeparatorPolicy()
-
-
Method Details
-
isEndOfRecord
True if the line can be parsed to a JSON object.- Specified by:
isEndOfRecordin interfaceRecordSeparatorPolicy- Overrides:
isEndOfRecordin classSimpleRecordSeparatorPolicy- Parameters:
line- a String without a newline character at the end.- Returns:
- true if this line is a complete record.
- See Also:
-