All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.testfabrik.webmate.javasdk.devices.DeviceRequirements Maven / Gradle / Ivy

There is a newer version: 0.56
Show newest version
package com.testfabrik.webmate.javasdk.devices;

import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.testfabrik.webmate.javasdk.JacksonMapper;

import java.util.Map;

public class DeviceRequirements {
    private final Map deviceProperties;

    public DeviceRequirements(Map deviceProperties) {
        this.deviceProperties = deviceProperties;
    }

    public Map getDeviceProperties() {
        return deviceProperties;
    }

    @JsonValue
    JsonNode toJson() {
        ObjectMapper om = JacksonMapper.getInstance();
        ObjectNode root = om.createObjectNode();
        for (Map.Entry entry : this.deviceProperties.entrySet()) {
            JsonNode jsonNode = om.valueToTree(entry.getValue());
            String s = entry.getValue().toString();
            root.set(entry.getKey().property, jsonNode);
        }

        return root;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy