Modifier and Type | Field and Description |
---|---|
private static String[] |
booleanAttributes |
private String |
key |
(package private) Attributes |
parent |
private String |
val |
Constructor and Description |
---|
Attribute(String key,
String value)
Create a new attribute from unencoded (raw) key and value.
|
Attribute(String key,
String val,
Attributes parent)
Create a new attribute from unencoded (raw) key and value.
|
Modifier and Type | Method and Description |
---|---|
Attribute |
clone() |
static Attribute |
createFromEncoded(String unencodedKey,
String encodedValue)
Create a new Attribute from an unencoded key and a HTML attribute encoded value.
|
boolean |
equals(Object o) |
String |
getKey()
Get the attribute key.
|
String |
getValue()
Get the attribute value.
|
int |
hashCode() |
String |
html()
Get the HTML representation of this attribute; e.g.
|
protected void |
html(Appendable accum,
Document.OutputSettings out) |
protected static void |
html(String key,
String val,
Appendable accum,
Document.OutputSettings out) |
protected boolean |
isBooleanAttribute()
Deprecated.
|
protected static boolean |
isBooleanAttribute(String key)
Checks if this attribute name is defined as a boolean attribute in HTML5
|
protected boolean |
isDataAttribute() |
protected static boolean |
isDataAttribute(String key) |
void |
setKey(String key)
Set the attribute key; case is preserved.
|
String |
setValue(String val)
Set the attribute value.
|
protected boolean |
shouldCollapseAttribute(Document.OutputSettings out)
Collapsible if it's a boolean attribute and value is empty or same as name
|
protected static boolean |
shouldCollapseAttribute(String key,
String val,
Document.OutputSettings out) |
String |
toString()
Get the string representation of this attribute, implemented as
html() . |
finalize, getClass, notify, notifyAll, wait, wait, wait
comparingByKey, comparingByKey, comparingByValue, comparingByValue
private static final String[] booleanAttributes
Attributes parent
public Attribute(String key, String value)
key
- attribute key; case is preserved.value
- attribute valuecreateFromEncoded(java.lang.String, java.lang.String)
public Attribute(String key, String val, Attributes parent)
key
- attribute key; case is preserved.val
- attribute valueparent
- the containing Attributes (this Attribute is not automatically added to said Attributes)createFromEncoded(java.lang.String, java.lang.String)
public void setKey(String key)
key
- the new key; must not be nullpublic String html()
href="index.html"
.protected static void html(String key, String val, Appendable accum, Document.OutputSettings out) throws IOException
IOException
protected void html(Appendable accum, Document.OutputSettings out) throws IOException
IOException
public String toString()
html()
.public static Attribute createFromEncoded(String unencodedKey, String encodedValue)
unencodedKey
- assumes the key is not encoded, as can be only run of simple \w chars.encodedValue
- HTML attribute encoded valueprotected boolean isDataAttribute()
protected static boolean isDataAttribute(String key)
protected final boolean shouldCollapseAttribute(Document.OutputSettings out)
out
- output settingsprotected static boolean shouldCollapseAttribute(String key, String val, Document.OutputSettings out)
protected boolean isBooleanAttribute()
protected static boolean isBooleanAttribute(String key)
public int hashCode()
WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses