Skip to content

Commit a6b9e93

Browse files
Work on Field properties
1 parent 62a73b5 commit a6b9e93

24 files changed

+143
-101
lines changed

src/main/java/io/frictionlessdata/tableschema/field/AnyField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public AnyField(String name) {
1919
}
2020

2121
public AnyField(String name, String format, String title, String description,
22-
URI rdfType, Map<String, Object> constraints, Map<String, Object> options){
23-
super(name, FIELD_TYPE_ANY, format, title, description, rdfType, constraints, options);
22+
URI rdfType, Map<String, Object> constraints, Map<String, Object> options, String example){
23+
super(name, FIELD_TYPE_ANY, format, title, description, rdfType, constraints, options, example);
2424
}
2525

2626
@Override

src/main/java/io/frictionlessdata/tableschema/field/ArrayField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public ArrayField(String name) {
2323
}
2424

2525
public ArrayField(String name, String format, String title, String description,
26-
URI rdfType, Map<String, Object> constraints, Map<String, Object> options){
27-
super(name, FIELD_TYPE_ARRAY, format, title, description, rdfType, constraints, options);
26+
URI rdfType, Map<String, Object> constraints, Map<String, Object> options, String example){
27+
super(name, FIELD_TYPE_ARRAY, format, title, description, rdfType, constraints, options, example);
2828
}
2929

3030
@Override

src/main/java/io/frictionlessdata/tableschema/field/BooleanField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ public BooleanField(String name) {
2929
}
3030

3131
public BooleanField(String name, String format, String title, String description,
32-
URI rdfType, Map<String, Object> constraints, Map<String, Object> options){
33-
super(name, FIELD_TYPE_BOOLEAN, format, title, description, rdfType, constraints, options);
32+
URI rdfType, Map<String, Object> constraints, Map<String, Object> options, String example){
33+
super(name, FIELD_TYPE_BOOLEAN, format, title, description, rdfType, constraints, options, example);
3434
}
3535

3636
public void setTrueValues(List<String> newValues) {

src/main/java/io/frictionlessdata/tableschema/field/DateField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public DateField(String name) {
2626
}
2727

2828
public DateField(String name, String format, String title, String description,
29-
URI rdfType, Map<String, Object> constraints, Map<String, Object> options){
30-
super(name, FIELD_TYPE_DATE, format, title, description, rdfType, constraints, options);
29+
URI rdfType, Map<String, Object> constraints, Map<String, Object> options, String example){
30+
super(name, FIELD_TYPE_DATE, format, title, description, rdfType, constraints, options, example);
3131
}
3232

3333
@Override

src/main/java/io/frictionlessdata/tableschema/field/DatetimeField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ public DatetimeField(String name) {
2727
}
2828

2929
public DatetimeField(String name, String format, String title, String description,
30-
URI rdfType, Map<String, Object> constraints, Map<String, Object> options){
31-
super(name, FIELD_TYPE_DATETIME, format, title, description, rdfType, constraints, options);
30+
URI rdfType, Map<String, Object> constraints, Map<String, Object> options, String example){
31+
super(name, FIELD_TYPE_DATETIME, format, title, description, rdfType, constraints, options, example);
3232
}
3333

3434
@Override

src/main/java/io/frictionlessdata/tableschema/field/DurationField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ public DurationField(String name) {
1919
}
2020

2121
public DurationField(String name, String format, String title, String description,
22-
URI rdfType, Map<String, Object> constraints, Map<String, Object> options){
23-
super(name, FIELD_TYPE_DURATION, format, title, description, rdfType, constraints, options);
22+
URI rdfType, Map<String, Object> constraints, Map<String, Object> options, String example){
23+
super(name, FIELD_TYPE_DURATION, format, title, description, rdfType, constraints, options, example);
2424
}
2525

2626
@Override

src/main/java/io/frictionlessdata/tableschema/field/Field.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
@JsonInclude(value = Include.NON_EMPTY)
2828
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, defaultImpl = AnyField.class,
2929
include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "type", visible = true)
30+
@JsonPropertyOrder({"name", "title", "type", "format", "example", "description", "rdfType", "constraints"})
3031
@JsonSubTypes({
3132
@JsonSubTypes.Type(value = StringField.class, name = Field.FIELD_TYPE_STRING),
3233
@JsonSubTypes.Type(value = IntegerField.class, name = Field.FIELD_TYPE_INTEGER),
@@ -125,6 +126,12 @@ public abstract class Field<T> {
125126
*/
126127
private String description = null;
127128

129+
/**
130+
* An example value for the field"
131+
*/
132+
private String example = null;
133+
134+
128135
/**
129136
* A field's `type` property is a string indicating the type of this field.
130137
* http://frictionlessdata.io/specs/table-schema/index.html#field-descriptors
@@ -149,6 +156,7 @@ public abstract class Field<T> {
149156

150157
Map<String, Object> constraints = null;
151158

159+
@JsonIgnore
152160
Map<String, Object> options = new HashMap<>();
153161

154162
@JsonAnyGetter
@@ -179,7 +187,8 @@ public Field(
179187
String description,
180188
URI rdfType,
181189
Map<String, Object> constraints,
182-
Map<String, Object> options){
190+
Map<String, Object> options,
191+
String example){
183192
this.name = name;
184193
this.type = type;
185194
this.format = format;
@@ -188,6 +197,7 @@ public Field(
188197
this.description = description;
189198
this.constraints = constraints;
190199
this.options = options;
200+
this.example = example;
191201
}
192202

193203
public static Field<?> fromJson (String json) {
@@ -579,6 +589,14 @@ public void setRdfType(URI rdfType) {
579589
this.rdfType = rdfType;
580590
}
581591

592+
public String getExample() {
593+
return example;
594+
}
595+
596+
public void setExample(String example) {
597+
this.example = example;
598+
}
599+
582600
public Map<String, Object> getOptions() {
583601
return options;
584602
}

src/main/java/io/frictionlessdata/tableschema/field/GeojsonField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ public GeojsonField(String name) {
3535
}
3636

3737
public GeojsonField(String name, String format, String title, String description,
38-
URI rdfType, Map<String, Object> constraints, Map<String, Object> options){
39-
super(name, FIELD_TYPE_GEOJSON, format, title, description, rdfType, constraints, options);
38+
URI rdfType, Map<String, Object> constraints, Map<String, Object> options, String example){
39+
super(name, FIELD_TYPE_GEOJSON, format, title, description, rdfType, constraints, options, example);
4040
}
4141

4242
@Override

src/main/java/io/frictionlessdata/tableschema/field/GeopointField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public GeopointField(String name) {
2323
}
2424

2525
public GeopointField(String name, String format, String title, String description,
26-
URI rdfType, Map<String, Object> constraints, Map<String, Object> options){
27-
super(name, FIELD_TYPE_GEOPOINT, format, title, description, rdfType, constraints, options);
26+
URI rdfType, Map<String, Object> constraints, Map<String, Object> options, String example){
27+
super(name, FIELD_TYPE_GEOPOINT, format, title, description, rdfType, constraints, options, example);
2828
}
2929

3030
@Override

src/main/java/io/frictionlessdata/tableschema/field/IntegerField.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ public IntegerField(String name) {
2424
}
2525

2626
public IntegerField(String name, String format, String title, String description,
27-
URI rdfType, Map<String, Object> constraints, Map<String, Object> options) {
28-
super(name, FIELD_TYPE_INTEGER, format, title, description, rdfType, constraints, options);
27+
URI rdfType, Map<String, Object> constraints, Map<String, Object> options, String example) {
28+
super(name, FIELD_TYPE_INTEGER, format, title, description, rdfType, constraints, options, example);
2929
}
3030

3131
@Override

0 commit comments

Comments
 (0)