@Target(value=TYPE) @Retention(value=RUNTIME) public @interface JsonTable
[
{
"id":1,
"FirstName":"John",
"LastName":"Doe",
"Age":20
},
{
"id":2,
"FirstName":"Susan",
"LastName":"Webber",
"Age":55
},
{
"id":1,
"FirstName":"Mike",
"LastName":"Smith",
"Age":34
}
]
You can parse and read the contents of this file into an entity by defining
this annotation on a Entity class like
@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;
...
}
Note: the getters and setter are omitted for brevity.Modifier and Type | Required Element and Description |
---|---|
String |
endpoint
On Class ONLY The endpoint where the document is located at.
|
Modifier and Type | Optional Element and 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
|
public abstract String endpoint
Function
<org.teiid.translator.ExecutionContext,
byte[]> or Function
<org.teiid.translator.ExecutionContext,
String> or Function
<org.teiid.translator.ExecutionContext,
InputStream> Where byte[], String and InputStream are response from the
REST call made.public abstract String source
public abstract boolean ordinal
public abstract String root
Copyright © 2020. All rights reserved.