Package javax.json

Examples of javax.json.JsonNumber


        mockQuery(Registration.findAll, registrations);
        final JsonArray result = this.cut.allAsJson();
        assertNotNull(result);
        assertThat(result.size(), is(1));
        JsonObject actual = result.getJsonObject(0);
        JsonNumber actualId = actual.getJsonNumber(Registrations.CONFIRMATION_ID);
        assertThat(expected.getId(), is(actualId.longValue()));

    }
View Full Code Here


        } else if (valueType == ValueType.TRUE) {
            contentHandler.characters(TRUE);
        } else if (valueType == ValueType.NULL) {
            // do nothing
        } else if (valueType == ValueType.NUMBER) {
            JsonNumber number = ((JsonNumber)jsonValue);
            contentHandler.characters(number.toString());                
        } else if (valueType == ValueType.OBJECT) {
            JsonObject childObject = (JsonObject) jsonValue;
            Iterator<Entry<String, JsonValue>> iter = childObject.entrySet().iterator();
            while (iter.hasNext()) {
                Entry<String, JsonValue> nextEntry = iter.next();
View Full Code Here

        mockQuery(Registration.findAll, registrations);
        final JsonArray result = this.cut.allAsJson();
        assertNotNull(result);
        assertThat(result.size(), is(1));
        JsonObject actual = result.getJsonObject(0);
        JsonNumber actualId = actual.getJsonNumber(Registrations.CONFIRMATION_ID);
        assertThat(expected.getId(), is(actualId.longValue()));

    }
View Full Code Here

        } else if (valueType == ValueType.TRUE) {
            contentHandler.characters(TRUE);
        } else if (valueType == ValueType.NULL) {
            // do nothing
        } else if (valueType == ValueType.NUMBER) {
            JsonNumber number = ((JsonNumber)jsonValue);
            contentHandler.characters(number.toString());                
        } else if (valueType == ValueType.OBJECT) {
            JsonObject childObject = (JsonObject) jsonValue;
            Iterator<Entry<String, JsonValue>> iter = childObject.entrySet().iterator();
            while (iter.hasNext()) {
                Entry<String, JsonValue> nextEntry = iter.next();
View Full Code Here

        mockQuery(Registration.findAll, registrations);
        final JsonArray result = this.cut.allAsJson();
        assertNotNull(result);
        assertThat(result.size(), is(1));
        JsonObject actual = result.getJsonObject(0);
        JsonNumber actualId = actual.getJsonNumber(Registrations.CONFIRMATION_ID);
        assertThat(expected.getId(), is(actualId.longValue()));

    }
View Full Code Here

    } else {
      timeSource = new SystemTimeTimeSource();
    }
    Simulation simulation = new Simulation(timeSource);

    JsonNumber resolution = simulationObject.getJsonNumber("resolution");
    simulation.setResolution(resolution != null ? resolution.longValue()
        : 1000L);

    JsonNumber temperature = simulationObject.getJsonNumber("temperature");
    if (temperature != null) {
      simulation.getContext().setTemperature(temperature.doubleValue());
    }
    JsonNumber brightness = simulationObject.getJsonNumber("brightness");
    if (brightness != null) {
      simulation.getContext().setBrightness(brightness.doubleValue());
    }

    JsonArray colorArray = simulationObject.getJsonArray("lightColor");
    if (colorArray != null && colorArray.size() == 3) {
      simulation.getContext().setLightColor(
View Full Code Here

      throws InstantiationException, IllegalAccessException,
      ClassNotFoundException, SimulationConfigurationException {
    Map<Integer, ISensor> sensorMap = new HashMap<Integer, ISensor>();
    Map<Integer, IActuator> actuatorMap = new HashMap<Integer, IActuator>();
    Room room = new Room();
    JsonNumber roomId = roomDescription.getJsonNumber("id");
    if (roomId != null) {
      room.setId(roomId.longValue());
    }
    String roomName = roomDescription.getString("name");
    if (roomName != null) {
      room.setName(roomName);
    }
View Full Code Here

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof JsonNumber)) {
            return false;
        }
        JsonNumber other = (JsonNumber)obj;
        return bigDecimalValue().equals(other.bigDecimalValue());
    }
View Full Code Here

TOP

Related Classes of javax.json.JsonNumber

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.