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

org.openqa.selenium.devtools.v88.css.model.CSSProperty Maven / Gradle / Ivy

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

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

/**
 * CSS property declaration data.
 */
public class CSSProperty {

    private final java.lang.String name;

    private final java.lang.String value;

    private final java.util.Optional important;

    private final java.util.Optional implicit;

    private final java.util.Optional text;

    private final java.util.Optional parsedOk;

    private final java.util.Optional disabled;

    private final java.util.Optional range;

    public CSSProperty(java.lang.String name, java.lang.String value, java.util.Optional important, java.util.Optional implicit, java.util.Optional text, java.util.Optional parsedOk, java.util.Optional disabled, java.util.Optional range) {
        this.name = java.util.Objects.requireNonNull(name, "name is required");
        this.value = java.util.Objects.requireNonNull(value, "value is required");
        this.important = important;
        this.implicit = implicit;
        this.text = text;
        this.parsedOk = parsedOk;
        this.disabled = disabled;
        this.range = range;
    }

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

    /**
     * The property value.
     */
    public java.lang.String getValue() {
        return value;
    }

    /**
     * Whether the property has "!important" annotation (implies `false` if absent).
     */
    public java.util.Optional getImportant() {
        return important;
    }

    /**
     * Whether the property is implicit (implies `false` if absent).
     */
    public java.util.Optional getImplicit() {
        return implicit;
    }

    /**
     * The full property text as specified in the style.
     */
    public java.util.Optional getText() {
        return text;
    }

    /**
     * Whether the property is understood by the browser (implies `true` if absent).
     */
    public java.util.Optional getParsedOk() {
        return parsedOk;
    }

    /**
     * Whether the property is disabled by the user (present for source-based properties only).
     */
    public java.util.Optional getDisabled() {
        return disabled;
    }

    /**
     * The entire property range in the enclosing style declaration (if available).
     */
    public java.util.Optional getRange() {
        return range;
    }

    private static CSSProperty fromJson(JsonInput input) {
        java.lang.String name = null;
        java.lang.String value = null;
        java.util.Optional important = java.util.Optional.empty();
        java.util.Optional implicit = java.util.Optional.empty();
        java.util.Optional text = java.util.Optional.empty();
        java.util.Optional parsedOk = java.util.Optional.empty();
        java.util.Optional disabled = java.util.Optional.empty();
        java.util.Optional range = java.util.Optional.empty();
        input.beginObject();
        while (input.hasNext()) {
            switch(input.nextName()) {
                case "name":
                    name = input.nextString();
                    break;
                case "value":
                    value = input.nextString();
                    break;
                case "important":
                    important = java.util.Optional.ofNullable(input.nextBoolean());
                    break;
                case "implicit":
                    implicit = java.util.Optional.ofNullable(input.nextBoolean());
                    break;
                case "text":
                    text = java.util.Optional.ofNullable(input.nextString());
                    break;
                case "parsedOk":
                    parsedOk = java.util.Optional.ofNullable(input.nextBoolean());
                    break;
                case "disabled":
                    disabled = java.util.Optional.ofNullable(input.nextBoolean());
                    break;
                case "range":
                    range = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.v88.css.model.SourceRange.class));
                    break;
                default:
                    input.skipValue();
                    break;
            }
        }
        input.endObject();
        return new CSSProperty(name, value, important, implicit, text, parsedOk, disabled, range);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy