Skip to content
Snippets Groups Projects
Commit 8be774e6 authored by Marco Sciacovelli's avatar Marco Sciacovelli
Browse files

Merge remote-tracking branch 'origin/master'

parents 1b99ac86 e9436a1c
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,10 @@ public class Event {
public String[] categories;
public GeoShape geometries;
public Event(){
}
public Event(String id,
HashMap<String, String> names,
String description,
......
import javax.json.bind.serializer.DeserializationContext;
import javax.json.bind.serializer.JsonbDeserializer;
import javax.json.stream.JsonParser;
import java.lang.reflect.Type;
import java.util.Arrays;
public class GeoShape {
public class GeoShape implements JsonbDeserializer<GeoShape> {
public String type;
public double[][] coordinates;
......@@ -12,6 +16,12 @@ public class GeoShape {
this.coordinates[1] = coordinates2;
}
public GeoShape() {
}
@Override
public String toString() {
return "GeoShape{" +
......@@ -19,5 +29,12 @@ public class GeoShape {
", coordinates=" + Arrays.toString(coordinates) +
'}';
}
@Override
public GeoShape deserialize(JsonParser parser, DeserializationContext ctx, Type rtType) {
return null;
}
}
......@@ -55,10 +55,18 @@ public class Main {
.build();
System.out.println(writing);
//JSONB
Jsonb jsonb = JsonbBuilder.create();
//Task 4
GeoShape geoShape = new GeoShape("geoShapes", new double[]{1000d,223d,121d},new double[]{1000d,223d,121d} );
Jsonb jsonb = JsonbBuilder.create();
System.out.println(jsonb.toJson(geoShape));
//Task 6
Event eve1 = jsonb.fromJson(jobj.toString(),Event.class);
System.out.println(eve1);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment