@Test public void testRequiredElements() { ObjectNode testInput = JsonUtils.newNode(); testInput.put("msgCnt", 88); testInput.put("id", "A0F1"); testInput.put("secMark", 4567); testInput.put("lat", 40741895); testInput.put("long", -73989308); testInput.put("elev", 3456); assertNotNull(BsmCoreDataBuilder.genericBsmCoreData(testInput)); }
public static J2735BsmCoreData genericBsmCoreData(JsonNode coreData) { J2735BsmCoreData genericBsmCoreData = new J2735BsmCoreData(); genericBsmCoreData.setMsgCnt(coreData.get("msgCnt").asInt()); genericBsmCoreData.setId(coreData.get("id").asText()); if (coreData.get("secMark").asInt() != 65535) { genericBsmCoreData.setSecMark(coreData.get("secMark").asInt()); } else { genericBsmCoreData.setSecMark(null); } genericBsmCoreData.setPosition(new OdePosition3D(LatitudeBuilder.genericLatitude(coreData.get("lat")), LongitudeBuilder.genericLongitude(coreData.get("long")), ElevationBuilder.genericElevation(coreData.get("elev")))); genericBsmCoreData.setAccelSet(AccelerationSet4WayBuilder.genericAccelerationSet4Way(coreData.get("accelSet"))); genericBsmCoreData.setAccuracy(PositionalAccuracyBuilder.genericPositionalAccuracy(coreData.get("accuracy"))); JsonNode transmission = coreData.get("transmission"); if (transmission != null) { int trans = transmission.asInt(); if (trans != J2735TransmissionState.UNAVAILABLE.ordinal()) { genericBsmCoreData.setTransmission(J2735TransmissionState.values()[trans]); } } genericBsmCoreData.setSpeed(SpeedOrVelocityBuilder.genericSpeed(coreData.get("speed"))); JsonNode heading = coreData.get("heading"); if (heading != null) { genericBsmCoreData.setHeading(HeadingBuilder.genericHeading(heading)); } genericBsmCoreData.setAngle(steeringAngle(coreData.get("angle"))); genericBsmCoreData.setBrakes(BrakeSystemStatusBuilder.genericBrakeSystemStatus(coreData.get("brakes"))); genericBsmCoreData.setSize(VehicleSizeBuilder.genericVehicleSize(coreData.get("size"))); return genericBsmCoreData; }
BsmCoreDataBuilder { public static J2735BsmCoreData genericBsmCoreData(JsonNode coreData) { J2735BsmCoreData genericBsmCoreData = new J2735BsmCoreData(); genericBsmCoreData.setMsgCnt(coreData.get("msgCnt").asInt()); genericBsmCoreData.setId(coreData.get("id").asText()); if (coreData.get("secMark").asInt() != 65535) { genericBsmCoreData.setSecMark(coreData.get("secMark").asInt()); } else { genericBsmCoreData.setSecMark(null); } genericBsmCoreData.setPosition(new OdePosition3D(LatitudeBuilder.genericLatitude(coreData.get("lat")), LongitudeBuilder.genericLongitude(coreData.get("long")), ElevationBuilder.genericElevation(coreData.get("elev")))); genericBsmCoreData.setAccelSet(AccelerationSet4WayBuilder.genericAccelerationSet4Way(coreData.get("accelSet"))); genericBsmCoreData.setAccuracy(PositionalAccuracyBuilder.genericPositionalAccuracy(coreData.get("accuracy"))); JsonNode transmission = coreData.get("transmission"); if (transmission != null) { int trans = transmission.asInt(); if (trans != J2735TransmissionState.UNAVAILABLE.ordinal()) { genericBsmCoreData.setTransmission(J2735TransmissionState.values()[trans]); } } genericBsmCoreData.setSpeed(SpeedOrVelocityBuilder.genericSpeed(coreData.get("speed"))); JsonNode heading = coreData.get("heading"); if (heading != null) { genericBsmCoreData.setHeading(HeadingBuilder.genericHeading(heading)); } genericBsmCoreData.setAngle(steeringAngle(coreData.get("angle"))); genericBsmCoreData.setBrakes(BrakeSystemStatusBuilder.genericBrakeSystemStatus(coreData.get("brakes"))); genericBsmCoreData.setSize(VehicleSizeBuilder.genericVehicleSize(coreData.get("size"))); return genericBsmCoreData; } }
BsmCoreDataBuilder { public static J2735BsmCoreData genericBsmCoreData(JsonNode coreData) { J2735BsmCoreData genericBsmCoreData = new J2735BsmCoreData(); genericBsmCoreData.setMsgCnt(coreData.get("msgCnt").asInt()); genericBsmCoreData.setId(coreData.get("id").asText()); if (coreData.get("secMark").asInt() != 65535) { genericBsmCoreData.setSecMark(coreData.get("secMark").asInt()); } else { genericBsmCoreData.setSecMark(null); } genericBsmCoreData.setPosition(new OdePosition3D(LatitudeBuilder.genericLatitude(coreData.get("lat")), LongitudeBuilder.genericLongitude(coreData.get("long")), ElevationBuilder.genericElevation(coreData.get("elev")))); genericBsmCoreData.setAccelSet(AccelerationSet4WayBuilder.genericAccelerationSet4Way(coreData.get("accelSet"))); genericBsmCoreData.setAccuracy(PositionalAccuracyBuilder.genericPositionalAccuracy(coreData.get("accuracy"))); JsonNode transmission = coreData.get("transmission"); if (transmission != null) { int trans = transmission.asInt(); if (trans != J2735TransmissionState.UNAVAILABLE.ordinal()) { genericBsmCoreData.setTransmission(J2735TransmissionState.values()[trans]); } } genericBsmCoreData.setSpeed(SpeedOrVelocityBuilder.genericSpeed(coreData.get("speed"))); JsonNode heading = coreData.get("heading"); if (heading != null) { genericBsmCoreData.setHeading(HeadingBuilder.genericHeading(heading)); } genericBsmCoreData.setAngle(steeringAngle(coreData.get("angle"))); genericBsmCoreData.setBrakes(BrakeSystemStatusBuilder.genericBrakeSystemStatus(coreData.get("brakes"))); genericBsmCoreData.setSize(VehicleSizeBuilder.genericVehicleSize(coreData.get("size"))); return genericBsmCoreData; } private  BsmCoreDataBuilder(); }
BsmCoreDataBuilder { public static J2735BsmCoreData genericBsmCoreData(JsonNode coreData) { J2735BsmCoreData genericBsmCoreData = new J2735BsmCoreData(); genericBsmCoreData.setMsgCnt(coreData.get("msgCnt").asInt()); genericBsmCoreData.setId(coreData.get("id").asText()); if (coreData.get("secMark").asInt() != 65535) { genericBsmCoreData.setSecMark(coreData.get("secMark").asInt()); } else { genericBsmCoreData.setSecMark(null); } genericBsmCoreData.setPosition(new OdePosition3D(LatitudeBuilder.genericLatitude(coreData.get("lat")), LongitudeBuilder.genericLongitude(coreData.get("long")), ElevationBuilder.genericElevation(coreData.get("elev")))); genericBsmCoreData.setAccelSet(AccelerationSet4WayBuilder.genericAccelerationSet4Way(coreData.get("accelSet"))); genericBsmCoreData.setAccuracy(PositionalAccuracyBuilder.genericPositionalAccuracy(coreData.get("accuracy"))); JsonNode transmission = coreData.get("transmission"); if (transmission != null) { int trans = transmission.asInt(); if (trans != J2735TransmissionState.UNAVAILABLE.ordinal()) { genericBsmCoreData.setTransmission(J2735TransmissionState.values()[trans]); } } genericBsmCoreData.setSpeed(SpeedOrVelocityBuilder.genericSpeed(coreData.get("speed"))); JsonNode heading = coreData.get("heading"); if (heading != null) { genericBsmCoreData.setHeading(HeadingBuilder.genericHeading(heading)); } genericBsmCoreData.setAngle(steeringAngle(coreData.get("angle"))); genericBsmCoreData.setBrakes(BrakeSystemStatusBuilder.genericBrakeSystemStatus(coreData.get("brakes"))); genericBsmCoreData.setSize(VehicleSizeBuilder.genericVehicleSize(coreData.get("size"))); return genericBsmCoreData; } private  BsmCoreDataBuilder(); static J2735BsmCoreData genericBsmCoreData(JsonNode coreData); }
BsmCoreDataBuilder { public static J2735BsmCoreData genericBsmCoreData(JsonNode coreData) { J2735BsmCoreData genericBsmCoreData = new J2735BsmCoreData(); genericBsmCoreData.setMsgCnt(coreData.get("msgCnt").asInt()); genericBsmCoreData.setId(coreData.get("id").asText()); if (coreData.get("secMark").asInt() != 65535) { genericBsmCoreData.setSecMark(coreData.get("secMark").asInt()); } else { genericBsmCoreData.setSecMark(null); } genericBsmCoreData.setPosition(new OdePosition3D(LatitudeBuilder.genericLatitude(coreData.get("lat")), LongitudeBuilder.genericLongitude(coreData.get("long")), ElevationBuilder.genericElevation(coreData.get("elev")))); genericBsmCoreData.setAccelSet(AccelerationSet4WayBuilder.genericAccelerationSet4Way(coreData.get("accelSet"))); genericBsmCoreData.setAccuracy(PositionalAccuracyBuilder.genericPositionalAccuracy(coreData.get("accuracy"))); JsonNode transmission = coreData.get("transmission"); if (transmission != null) { int trans = transmission.asInt(); if (trans != J2735TransmissionState.UNAVAILABLE.ordinal()) { genericBsmCoreData.setTransmission(J2735TransmissionState.values()[trans]); } } genericBsmCoreData.setSpeed(SpeedOrVelocityBuilder.genericSpeed(coreData.get("speed"))); JsonNode heading = coreData.get("heading"); if (heading != null) { genericBsmCoreData.setHeading(HeadingBuilder.genericHeading(heading)); } genericBsmCoreData.setAngle(steeringAngle(coreData.get("angle"))); genericBsmCoreData.setBrakes(BrakeSystemStatusBuilder.genericBrakeSystemStatus(coreData.get("brakes"))); genericBsmCoreData.setSize(VehicleSizeBuilder.genericVehicleSize(coreData.get("size"))); return genericBsmCoreData; } private  BsmCoreDataBuilder(); static J2735BsmCoreData genericBsmCoreData(JsonNode coreData);  }