Package com.teamdev.jxbrowser.dom
Interface ElementAttributes
public interface ElementAttributes
HTML attributes that are specified on a particular
Element.-
Method Summary
Modifier and TypeMethodDescriptionasMap()Returns an immutable map that contains attributes of the element.asNodes()Returns an immutable list that contains attribute nodes of the element.booleanReturnstruewhen an attribute with the givennameis specified on the element or has a default value, otherwise returnsfalse.element()ReturnsElement, on which these attributes are specified.Returns the value of the attribute with the givenname.voidAdds a new attribute with the givennameandvalue.voidRemoves an attribute with the givenname.intsize()Returns a number of the specified attributes.
-
Method Details
-
element
Element element()ReturnsElement, on which these attributes are specified. -
size
int size()Returns a number of the specified attributes.- Throws:
ObjectClosedException- when the element is closed
-
get
Returns the value of the attribute with the givenname.The returned string is empty if the attribute with the given
nameis not specified on the element, or has no value.- Parameters:
name- the attribute name- Throws:
IllegalArgumentException- whennameis empty or blankObjectClosedException- when the element is closed
-
put
Adds a new attribute with the givennameandvalue.If an attribute with the given
nameis already specified, its value will be replaced with the new one.- Parameters:
name- the name of the attribute to add or altervalue- value to set in string form. Can be empty for boolean attribute names which are always true despite the attribute value- Throws:
IllegalArgumentException- whennameis empty or blankObjectClosedException- when the element is closed
-
remove
Removes an attribute with the givenname.This method does nothing if an attribute with the given
nameis not specified on the element.- Parameters:
name- the name of the attribute to remove- Throws:
IllegalArgumentException- whennameis empty or blankObjectClosedException- when the element is closed
-
contains
Returnstruewhen an attribute with the givennameis specified on the element or has a default value, otherwise returnsfalse.- Parameters:
name- the name of the attribute- Throws:
IllegalArgumentException- whennameis empty or blankObjectClosedException- when the element is closed
-
asMap
Returns an immutable map that contains attributes of the element.Each map entry is a pair of strings where
keystands for the attribute name andvaluestands for the attribute value.The returned map is empty if the element does not have attributes.
- Throws:
ObjectClosedException- when the element is closed
-
asNodes
Returns an immutable list that contains attribute nodes of the element.The returned list is empty if the element does not have attributes.
- Throws:
ObjectClosedException- when the element is closed
-