public class CustomTag extends Object implements Tag
Tag
Constructor and Description |
---|
CustomTag(String name,
Tag.Type type)
Create new tag.
|
CustomTag(Tag tag)
Create a CustomTag based on an existing Tag - this takes a copy of the Tag.
|
Modifier and Type | Method and Description |
---|---|
int |
addAttribute(String name,
String value)
Add a new attribute.
|
boolean |
equals(Object o) |
int |
getAttributeCount()
Number of attributes in tag.
|
int |
getAttributeIndex(String name,
boolean caseSensitive)
Determine which attribute has the specified name.
|
String |
getAttributeName(int index)
Get name of attribute.
|
String |
getAttributeValue(int index)
Get value of an attribute.
|
String |
getAttributeValue(String name,
boolean caseSensitive)
Get value of an attribute.
|
String |
getName()
Name of tag (ie.
|
Tag.Type |
getType()
Type of tag.
|
boolean |
hasAttribute(String name,
boolean caseSensitive)
Determine if an attribute is present.
|
int |
hashCode() |
void |
removeAttribute(int attributeIndex)
Remove an attribute.
|
void |
removeAttribute(String name,
boolean caseSensitive)
Change the value of an attribute, or add an attribute if it does not already exist.
|
void |
setAttributeName(int attributeIndex,
String name)
Change the name of an existing attribute.
|
void |
setAttributeValue(int attributeIndex,
String value)
Change the value of an existing attribute.
|
void |
setAttributeValue(String name,
boolean caseSensitive,
String value)
Change the value of an attribute, or add an attribute if it does not already exist.
|
void |
setName(String name)
Change the name of the attribute.
|
void |
setType(Tag.Type type)
Change the type of the tag.
|
String |
toString()
Get the complete tag in its original form, preserving original formatting.
|
void |
writeTo(Appendable out)
Write out the complete tag in its original form, preserving original formatting.
|
public CustomTag(Tag tag)
public void writeTo(Appendable out) throws IOException
Tag
writeTo
in interface Tag
IOException
public String toString()
Tag
This has a slight overhead in that it needs to construct a String. For improved performance, use writeTo() instead.
toString
in interface Tag
toString
in class Object
Tag.writeTo(Appendable)
public int getAttributeCount()
Tag
getAttributeCount
in interface Tag
public int getAttributeIndex(String name, boolean caseSensitive)
Tag
getAttributeIndex
in interface Tag
public String getAttributeName(int index)
Tag
getAttributeName
in interface Tag
public String getAttributeValue(int index)
Tag
getAttributeValue
in interface Tag
public String getAttributeValue(String name, boolean caseSensitive)
Tag
getAttributeValue
in interface Tag
public boolean hasAttribute(String name, boolean caseSensitive)
Tag
hasAttribute
in interface Tag
public String getName()
Tag
public Tag.Type getType()
public void setName(String name)
public void setType(Tag.Type type)
public int addAttribute(String name, String value)
name
- Name of attribute to change.value
- New value of attribute or null for an HTML style empty attribute.public void setAttributeValue(String name, boolean caseSensitive, String value)
name
- Name of attribute to change.caseSensitive
- Whether the name should be treated as case sensitive when searching for an existing value.value
- New value of attribute or null for an HTML style empty attribute.public void setAttributeName(int attributeIndex, String name)
public void setAttributeValue(int attributeIndex, String value)
public void removeAttribute(int attributeIndex)
public void removeAttribute(String name, boolean caseSensitive)
name
- Name of attribute to remove.caseSensitive
- Whether the name should be treated as case sensitive.Copyright © 2015. All Rights Reserved.