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

org.openqa.selenium.devtools.v90.accessibility.model.AXValue 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.accessibility.model;

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

/**
 * A single computed AX property.
 */
public class AXValue {

    private final org.openqa.selenium.devtools.v90.accessibility.model.AXValueType type;

    private final java.util.Optional value;

    private final java.util.Optional> relatedNodes;

    private final java.util.Optional> sources;

    public AXValue(org.openqa.selenium.devtools.v90.accessibility.model.AXValueType type, java.util.Optional value, java.util.Optional> relatedNodes, java.util.Optional> sources) {
        this.type = java.util.Objects.requireNonNull(type, "type is required");
        this.value = value;
        this.relatedNodes = relatedNodes;
        this.sources = sources;
    }

    /**
     * The type of this value.
     */
    public org.openqa.selenium.devtools.v90.accessibility.model.AXValueType getType() {
        return type;
    }

    /**
     * The computed value of this property.
     */
    public java.util.Optional getValue() {
        return value;
    }

    /**
     * One or more related nodes, if applicable.
     */
    public java.util.Optional> getRelatedNodes() {
        return relatedNodes;
    }

    /**
     * The sources which contributed to the computation of this property.
     */
    public java.util.Optional> getSources() {
        return sources;
    }

    private static AXValue fromJson(JsonInput input) {
        org.openqa.selenium.devtools.v90.accessibility.model.AXValueType type = null;
        java.util.Optional value = java.util.Optional.empty();
        java.util.Optional> relatedNodes = java.util.Optional.empty();
        java.util.Optional> sources = java.util.Optional.empty();
        input.beginObject();
        while (input.hasNext()) {
            switch(input.nextName()) {
                case "type":
                    type = input.read(org.openqa.selenium.devtools.v90.accessibility.model.AXValueType.class);
                    break;
                case "value":
                    value = java.util.Optional.ofNullable(input.read(Object.class));
                    break;
                case "relatedNodes":
                    relatedNodes = java.util.Optional.ofNullable(input.read(new com.google.common.reflect.TypeToken>() {
                    }.getType()));
                    break;
                case "sources":
                    sources = java.util.Optional.ofNullable(input.read(new com.google.common.reflect.TypeToken>() {
                    }.getType()));
                    break;
                default:
                    input.skipValue();
                    break;
            }
        }
        input.endObject();
        return new AXValue(type, value, relatedNodes, sources);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy