public class Attributes extends Object implements Iterable<Attribute>, Cloneable
Attributes are treated as a map: there can be only one value associated with an attribute key.
Attribute key and value comparisons are done case insensitively, and keys are normalised to lower-case.
Modifier and Type | Field and Description |
---|---|
protected static String |
dataPrefix |
Constructor and Description |
---|
Attributes() |
Modifier and Type | Method and Description |
---|---|
void |
addAll(Attributes incoming)
Add all the attributes from the incoming set to this set.
|
List<Attribute> |
asList()
Get the attributes as a List, for iteration.
|
Object |
clone() |
Map<String,String> |
dataset()
Retrieves a filtered view of attributes that are HTML5 custom data attributes; that is, attributes with keys starting with data- .
|
boolean |
equals(Object o)
Checks if these attributes are equal to another set of attributes, by comparing the two sets
|
String |
get(String key)
Get an attribute value by key.
|
int |
hashCode()
Calculates the hashcode of these attributes, by iterating all attributes and summing their hashcodes.
|
boolean |
hasKey(String key)
Tests if these attributes contain an attribute with this key.
|
String |
html()
Get the HTML representation of these attributes.
|
Iterator<Attribute> |
iterator() |
void |
put(Attribute attribute)
Set a new attribute, or replace an existing one by key.
|
void |
put(String key, boolean value)
Set a new boolean attribute, remove attribute if value is false.
|
void |
put(String key, String value)
Set a new attribute, or replace an existing one by key.
|
void |
remove(String key)
Remove an attribute by key.
|
int |
size()
Get the number of attributes in this set.
|
String |
toString() |
finalize, getClass, notify, notifyAll, wait, wait, wait
forEach, spliterator
protected static final String dataPrefix
public String get(String key)
key
- the attribute key
hasKey(String)
public void put(String key, String value)
key
- attribute key
value
- attribute value
public void put(String key, boolean value)
key
- attribute key
value
- attribute value
public void put(Attribute attribute)
attribute
- attribute
public void remove(String key)
key
- attribute key to remove
public boolean hasKey(String key)
key
- key to check for
public int size()
public void addAll(Attributes incoming)
incoming
- attributes to add to these attributes.
public List<Attribute> asList()
public Map<String,String> dataset()
data-
.
public String html()
SerializationException
- if the HTML representation of the attributes cannot be constructed.
public boolean equals(Object o)
public int hashCode()
Copyright © 1998–2019 iText Group NV. All rights reserved.