org.openqa.selenium.devtools.css.model.InheritedStyleEntry Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of selenium-devtools Show documentation
Show all versions of selenium-devtools Show documentation
Selenium automates browsers. That's it! What you do with that power is entirely up to you.
package org.openqa.selenium.devtools.css.model;
import org.openqa.selenium.Beta;
import org.openqa.selenium.json.JsonInput;
/**
* Inherited CSS rule collection from ancestor node.
*/
public class InheritedStyleEntry {
private final java.util.Optional inlineStyle;
private final java.util.List matchedCSSRules;
public InheritedStyleEntry(java.util.Optional inlineStyle, java.util.List matchedCSSRules) {
this.inlineStyle = inlineStyle;
this.matchedCSSRules = java.util.Objects.requireNonNull(matchedCSSRules, "matchedCSSRules is required");
}
/**
* The ancestor node's inline style, if any, in the style inheritance chain.
*/
public java.util.Optional getInlineStyle() {
return inlineStyle;
}
/**
* Matches of CSS rules matching the ancestor node in the style inheritance chain.
*/
public java.util.List getMatchedCSSRules() {
return matchedCSSRules;
}
private static InheritedStyleEntry fromJson(JsonInput input) {
java.util.Optional inlineStyle = java.util.Optional.empty();
java.util.List matchedCSSRules = null;
input.beginObject();
while (input.hasNext()) {
switch(input.nextName()) {
case "inlineStyle":
inlineStyle = java.util.Optional.ofNullable(input.read(org.openqa.selenium.devtools.css.model.CSSStyle.class));
break;
case "matchedCSSRules":
matchedCSSRules = input.read(new com.google.common.reflect.TypeToken>() {
}.getType());
break;
default:
input.skipValue();
break;
}
}
input.endObject();
return new InheritedStyleEntry(inlineStyle, matchedCSSRules);
}
}