Why is IACircle
constructor not called?
This is how I load the Json ..
BufferedReader br = new BufferedReader(in);
LevelDefinition ld = new Gson().fromJson(br, LevelDefinition.class);
Json string ..
{
"iaCircles": [
{
"x": -32.0,
"y": -5.0,
"angle": 0.0,
"radius": 2.5,
"density": 0.0,
"friction": 0.0,
"restitution": 1.0,
"textureSelection": "CIRCLE",
"inflictsDamage": true,
"fixedRotation":true
},
{
"x": 55.0,
"y": -5.0,
"angle": 0.0,
"radius": 2.5,
"density": 0.0,
"friction": 0.0,
"restitution": 1.0,
"textureSelection": "CIRCLE",
"inflictsDamage": true,
"fixedRotation":true
}
]
}
Java class parsed into ..
public class LevelDefinition {
private Vector<IACircle> iaCircles;
}
IACircle
definition ..
public class IACircle {
public IACircle (
float x, float y, float angle, float radius,
float density, float friction, float restitution,
String textureSelection, boolean inflictsDamage, boolean fixedRotation) {
System.out.println("constructor called, circle");
}
}