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

org.openqa.selenium.devtools.v90.performance.model.Metric Maven / Gradle / Ivy

Go to download

Selenium automates browsers. That's it! What you do with that power is entirely up to you.

There is a newer version: 4.0.0-beta-4
Show newest version
package org.openqa.selenium.devtools.v90.performance.model;

import org.openqa.selenium.Beta;
import org.openqa.selenium.json.JsonInput;

/**
 * Run-time execution metric.
 */
public class Metric {

    private final java.lang.String name;

    private final java.lang.Number value;

    public Metric(java.lang.String name, java.lang.Number value) {
        this.name = java.util.Objects.requireNonNull(name, "name is required");
        this.value = java.util.Objects.requireNonNull(value, "value is required");
    }

    /**
     * Metric name.
     */
    public java.lang.String getName() {
        return name;
    }

    /**
     * Metric value.
     */
    public java.lang.Number getValue() {
        return value;
    }

    private static Metric fromJson(JsonInput input) {
        java.lang.String name = null;
        java.lang.Number value = 0;
        input.beginObject();
        while (input.hasNext()) {
            switch(input.nextName()) {
                case "name":
                    name = input.nextString();
                    break;
                case "value":
                    value = input.nextNumber();
                    break;
                default:
                    input.skipValue();
                    break;
            }
        }
        input.endObject();
        return new Metric(name, value);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy