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

org.openqa.selenium.devtools.runtime.model.PrivatePropertyDescriptor 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-rc-1
Show newest version
package org.openqa.selenium.devtools.runtime.model;

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

/**
 * Object private field descriptor.
 */
@org.openqa.selenium.Beta()
public class PrivatePropertyDescriptor {

    private final java.lang.String name;

    private final java.util.Optional value;

    private final java.util.Optional get;

    private final java.util.Optional set;

    public PrivatePropertyDescriptor(java.lang.String name, java.util.Optional value, java.util.Optional get, java.util.Optional set) {
        this.name = java.util.Objects.requireNonNull(name, "name is required");
        this.value = value;
        this.get = get;
        this.set = set;
    }

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

    /**
     * The value associated with the private property.
     */
    public java.util.Optional getValue() {
        return value;
    }

    /**
     * A function which serves as a getter for the private property,
     * or `undefined` if there is no getter (accessor descriptors only).
     */
    public java.util.Optional getGet() {
        return get;
    }

    /**
     * A function which serves as a setter for the private property,
     * or `undefined` if there is no setter (accessor descriptors only).
     */
    public java.util.Optional getSet() {
        return set;
    }

    private static PrivatePropertyDescriptor fromJson(JsonInput input) {
        java.lang.String name = null;
        java.util.Optional value = java.util.Optional.empty();
        java.util.Optional get = java.util.Optional.empty();
        java.util.Optional set = java.util.Optional.empty();
        input.beginObject();
        while (input.hasNext()) {
            switch(input.nextName()) {
                case "name":
                    name = input.nextString();
                    break;
                case "value":
                    value = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.runtime.model.RemoteObject.class));
                    break;
                case "get":
                    get = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.runtime.model.RemoteObject.class));
                    break;
                case "set":
                    set = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.runtime.model.RemoteObject.class));
                    break;
                default:
                    input.skipValue();
                    break;
            }
        }
        input.endObject();
        return new PrivatePropertyDescriptor(name, value, get, set);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy