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

org.openqa.selenium.devtools.v88.runtime.model.PropertyDescriptor Maven / Gradle / Ivy

package org.openqa.selenium.devtools.v88.runtime.model;

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

/**
 * Object property descriptor.
 */
public class PropertyDescriptor {

    private final java.lang.String name;

    private final java.util.Optional value;

    private final java.util.Optional writable;

    private final java.util.Optional get;

    private final java.util.Optional set;

    private final java.lang.Boolean configurable;

    private final java.lang.Boolean enumerable;

    private final java.util.Optional wasThrown;

    private final java.util.Optional isOwn;

    private final java.util.Optional symbol;

    public PropertyDescriptor(java.lang.String name, java.util.Optional value, java.util.Optional writable, java.util.Optional get, java.util.Optional set, java.lang.Boolean configurable, java.lang.Boolean enumerable, java.util.Optional wasThrown, java.util.Optional isOwn, java.util.Optional symbol) {
        this.name = java.util.Objects.requireNonNull(name, "name is required");
        this.value = value;
        this.writable = writable;
        this.get = get;
        this.set = set;
        this.configurable = java.util.Objects.requireNonNull(configurable, "configurable is required");
        this.enumerable = java.util.Objects.requireNonNull(enumerable, "enumerable is required");
        this.wasThrown = wasThrown;
        this.isOwn = isOwn;
        this.symbol = symbol;
    }

    /**
     * Property name or symbol description.
     */
    public java.lang.String getName() {
        return name;
    }

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

    /**
     * True if the value associated with the property may be changed (data descriptors only).
     */
    public java.util.Optional getWritable() {
        return writable;
    }

    /**
     * A function which serves as a getter for the 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 property, or `undefined` if there is no setter
     * (accessor descriptors only).
     */
    public java.util.Optional getSet() {
        return set;
    }

    /**
     * True if the type of this property descriptor may be changed and if the property may be
     * deleted from the corresponding object.
     */
    public java.lang.Boolean getConfigurable() {
        return configurable;
    }

    /**
     * True if this property shows up during enumeration of the properties on the corresponding
     * object.
     */
    public java.lang.Boolean getEnumerable() {
        return enumerable;
    }

    /**
     * True if the result was thrown during the evaluation.
     */
    public java.util.Optional getWasThrown() {
        return wasThrown;
    }

    /**
     * True if the property is owned for the object.
     */
    public java.util.Optional getIsOwn() {
        return isOwn;
    }

    /**
     * Property symbol object, if the property is of the `symbol` type.
     */
    public java.util.Optional getSymbol() {
        return symbol;
    }

    private static PropertyDescriptor fromJson(JsonInput input) {
        java.lang.String name = null;
        java.util.Optional value = java.util.Optional.empty();
        java.util.Optional writable = java.util.Optional.empty();
        java.util.Optional get = java.util.Optional.empty();
        java.util.Optional set = java.util.Optional.empty();
        java.lang.Boolean configurable = false;
        java.lang.Boolean enumerable = false;
        java.util.Optional wasThrown = java.util.Optional.empty();
        java.util.Optional isOwn = java.util.Optional.empty();
        java.util.Optional symbol = 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.v88.runtime.model.RemoteObject.class));
                    break;
                case "writable":
                    writable = java.util.Optional.ofNullable(input.nextBoolean());
                    break;
                case "get":
                    get = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v88.runtime.model.RemoteObject.class));
                    break;
                case "set":
                    set = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v88.runtime.model.RemoteObject.class));
                    break;
                case "configurable":
                    configurable = input.nextBoolean();
                    break;
                case "enumerable":
                    enumerable = input.nextBoolean();
                    break;
                case "wasThrown":
                    wasThrown = java.util.Optional.ofNullable(input.nextBoolean());
                    break;
                case "isOwn":
                    isOwn = java.util.Optional.ofNullable(input.nextBoolean());
                    break;
                case "symbol":
                    symbol = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v88.runtime.model.RemoteObject.class));
                    break;
                default:
                    input.skipValue();
                    break;
            }
        }
        input.endObject();
        return new PropertyDescriptor(name, value, writable, get, set, configurable, enumerable, wasThrown, isOwn, symbol);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy