public class JsonDataSource extends JRAbstractTextDataSource implements JsonData
| Modifier and Type | Field and Description |
|---|---|
static String |
EXCEPTION_MESSAGE_KEY_INVALID_ATTRIBUTE_SELECTION |
static String |
EXCEPTION_MESSAGE_KEY_INVALID_EXPRESSION |
static String |
EXCEPTION_MESSAGE_KEY_JSON_FIELD_VALUE_NOT_RETRIEVED |
static String |
EXCEPTION_MESSAGE_KEY_NO_DATA |
EXCEPTION_MESSAGE_KEY_CANNOT_CONVERT_FIELD_TYPE, EXCEPTION_MESSAGE_KEY_CANNOT_MODIFY_PROPERTIES_AFTER_START, EXCEPTION_MESSAGE_KEY_NODE_NOT_AVAILABLE, EXCEPTION_MESSAGE_KEY_NULL_DOCUMENT, EXCEPTION_MESSAGE_KEY_NULL_SELECT_EXPRESSION, EXCEPTION_MESSAGE_KEY_UNKNOWN_COLUMN_NAME, EXCEPTION_MESSAGE_KEY_UNKNOWN_NUMBER_TYPE| Modifier | Constructor and Description |
|---|---|
|
JsonDataSource(File file) |
|
JsonDataSource(File file,
String selectExpression) |
|
JsonDataSource(InputStream stream) |
|
JsonDataSource(InputStream jsonStream,
String selectExpression) |
|
JsonDataSource(JasperReportsContext jasperReportsContext,
String location,
String selectExpression)
Creates a data source instance that reads JSON data from a given location
|
protected |
JsonDataSource(com.fasterxml.jackson.databind.JsonNode jsonTree,
String selectExpression) |
|
JsonDataSource(String location,
String selectExpression) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Deprecated.
no longer required
|
Object |
getFieldValue(JRField jrField)
Gets the field value for the current position.
|
protected com.fasterxml.jackson.databind.JsonNode |
getJsonData(com.fasterxml.jackson.databind.JsonNode rootNode,
String jsonExpression)
Extracts the JSON nodes based on the query expression
|
protected com.fasterxml.jackson.databind.JsonNode |
goDownPath(com.fasterxml.jackson.databind.JsonNode rootNode,
String simplePath)
Extracts the JSON nodes under the simple path
|
protected com.fasterxml.jackson.databind.JsonNode |
goDownPathWithAttribute(com.fasterxml.jackson.databind.JsonNode rootNode,
String pathWithAttributeExpression)
Extracts the JSON nodes that match the attribute expression
|
protected boolean |
isValidExpression(com.fasterxml.jackson.databind.JsonNode operand,
String attributeExpression)
Validates an attribute expression on a JsonNode
|
void |
moveFirst()
Moves back to the first element in the data source.
|
boolean |
next()
Tries to position the cursor on the next element in the data source.
|
JsonDataSource |
subDataSource()
Creates a sub data source using the current node as the base for its input stream.
|
JsonDataSource |
subDataSource(String selectExpression)
Creates a sub data source using the current node as the base for its input stream.
|
convertNumber, convertStringValue, getConvertBean, getDatePattern, getFormattedDate, getFormattedNumber, getLocale, getNumberPattern, getTextAttributes, getTimeZone, setDatePattern, setLocale, setLocale, setNumberPattern, setTextAttributes, setTextAttributes, setTimeZone, setTimeZonepublic static final String EXCEPTION_MESSAGE_KEY_JSON_FIELD_VALUE_NOT_RETRIEVED
public static final String EXCEPTION_MESSAGE_KEY_INVALID_ATTRIBUTE_SELECTION
public static final String EXCEPTION_MESSAGE_KEY_INVALID_EXPRESSION
public static final String EXCEPTION_MESSAGE_KEY_NO_DATA
public JsonDataSource(InputStream stream) throws JRException
JRExceptionpublic JsonDataSource(InputStream jsonStream, String selectExpression) throws JRException
JRExceptionprotected JsonDataSource(com.fasterxml.jackson.databind.JsonNode jsonTree,
String selectExpression)
throws JRException
JRExceptionpublic JsonDataSource(File file) throws FileNotFoundException, JRException
FileNotFoundExceptionJRExceptionpublic JsonDataSource(File file, String selectExpression) throws FileNotFoundException, JRException
FileNotFoundExceptionJRExceptionpublic JsonDataSource(JasperReportsContext jasperReportsContext, String location, String selectExpression) throws JRException
jasperReportsContext - the JasperReportsContextlocation - a String representing JSON data sourceselectExpression - a String representing the select expressionJRExceptionpublic JsonDataSource(String location, String selectExpression) throws JRException
JRExceptionJsonDataSource(JasperReportsContext, String, String)public void moveFirst()
throws JRException
JRRewindableDataSourcemoveFirst in interface JRRewindableDataSourceJRExceptionpublic boolean next()
JRDataSourcenext in interface JRDataSourcepublic Object getFieldValue(JRField jrField) throws JRException
JRDataSourcegetFieldValue in interface JRDataSourceJRExceptionprotected com.fasterxml.jackson.databind.JsonNode getJsonData(com.fasterxml.jackson.databind.JsonNode rootNode,
String jsonExpression)
throws JRException
rootNode - jsonExpression - JRExceptionprotected com.fasterxml.jackson.databind.JsonNode goDownPathWithAttribute(com.fasterxml.jackson.databind.JsonNode rootNode,
String pathWithAttributeExpression)
throws JRException
rootNode - pathWithAttributeExpression - : e.g. Orders(CustomerId == HILAA)JRExceptionprotected com.fasterxml.jackson.databind.JsonNode goDownPath(com.fasterxml.jackson.databind.JsonNode rootNode,
String simplePath)
rootNode - simplePath - - a simple field name, with no selection by attributeprotected boolean isValidExpression(com.fasterxml.jackson.databind.JsonNode operand,
String attributeExpression)
throws JRException
operand - attributeExpression - JRExceptionpublic JsonDataSource subDataSource() throws JRException
subDataSource in interface JsonDataJRExceptionpublic JsonDataSource subDataSource(String selectExpression) throws JRException
subDataSource in interface JsonDataselectExpression - JRException@Deprecated public void close()
Copyright © 2017. All rights reserved.