Package org.teiid.spring.annotations
Annotation Type JsonTable
-
@Target(TYPE) @Retention(RUNTIME) public @interface JsonTable
Use this annotation on any Entity class, that defines the data from a JSON file or web resource.
For Example if you have a JSON payload like[ { "id":1, "FirstName":"John", "LastName":"Doe", "Age":20 }, { "id":2, "FirstName":"Susan", "LastName":"Webber", "Age":55 }, { "id":1, "FirstName":"Mike", "LastName":"Smith", "Age":34 } ]
@Entity @JsonTable(source=file, endpoint="/path/to/file.txt" rootIsArray=true) public class Person { @Id private int id; @Column(name="FirstName") private String firstName; @Column(name="LastName") private String lastName; @Column(name="Age") private int age; ... }
For more information checkout XMLTABLE in Teiid.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description boolean
ordinal
On Column ONLY, this defines the column as ordinal identity column.String
root
Root of the document where the parsing needs to start from.boolean
rootIsArray
JSON root content is array.String
source
Source name; If overriding the org.teiid.translator.ws.WsExecutionFactory bean then provide the name of the bean
-
-
-
Element Detail
-
endpoint
String endpoint
On Class ONLY The endpoint where the document is located at. If this is file resource then this field can be used to define name of the file. If this is REST based call, it can either define the endpoint URL or can refer to a bean name that returnsFunction
<org.teiid.translator.ExecutionContext, byte[]> orFunction
<org.teiid.translator.ExecutionContext, String> orFunction
<org.teiid.translator.ExecutionContext, InputStream> Where byte[], String and InputStream are response from the REST call made.- Returns:
- string - file/endpoint or name of the bean
-
-
-
source
String source
Source name; If overriding the org.teiid.translator.ws.WsExecutionFactory bean then provide the name of the bean- Returns:
- string
- Default:
- "rest"
-
-
-
root
String root
Root of the document where the parsing needs to start from.- Returns:
- string
- Default:
- "/"
-
-