public class CustomTag extends java.lang.Object implements Tag
Tag
Modifier and Type | Field and Description |
---|---|
private int |
attributeCount |
private java.lang.String[] |
attributes |
private java.lang.String |
name |
private int |
type |
CLOSE, CLOSE_MAGIC_COMMENT, EMPTY, OPEN, OPEN_MAGIC_COMMENT
Constructor and Description |
---|
CustomTag(java.lang.String name,
int type)
Type of tag:
<blah> - Tag.OPEN </blah> - Tag.CLOSE <blah/> - Tag.EMPTY |
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(java.lang.String name,
java.lang.String value)
Add a new attribute.
|
boolean |
equals(java.lang.Object o) |
int |
getAttributeCount()
Number of attributes in tag.
|
int |
getAttributeIndex(java.lang.String name,
boolean caseSensitive)
Determine which attribute has the specified name.
|
java.lang.String |
getAttributeName(int index)
Get name of attribute.
|
java.lang.String |
getAttributeValue(int index)
Get value of an attribute.
|
java.lang.String |
getAttributeValue(java.lang.String name,
boolean caseSensitive)
Get value of an attribute.
|
java.lang.String |
getContents()
Get the complete tag in its original form, preserving original formatting.
|
int |
getLength()
The length of the tag
|
java.lang.String |
getName()
Name of tag (ie.
|
int |
getPosition()
The position of the tag
|
int |
getType()
Type of tag:
<blah> - Tag.OPEN </blah> - Tag.CLOSE <blah/> - Tag.EMPTY |
private void |
growAttributes() |
boolean |
hasAttribute(java.lang.String name,
boolean caseSensitive)
Determine if an attribute is present.
|
int |
hashCode() |
void |
removeAttribute(int attributeIndex)
Remove an attribute.
|
void |
removeAttribute(java.lang.String name,
boolean caseSensitive)
Change the value of an attribute, or add an attribute if it does not already exist.
|
void |
setAttributeName(int attributeIndex,
java.lang.String name)
Change the name of an existing attribute.
|
void |
setAttributeValue(int attributeIndex,
java.lang.String value)
Change the value of an existing attribute.
|
void |
setAttributeValue(java.lang.String name,
boolean caseSensitive,
java.lang.String value)
Change the value of an attribute, or add an attribute if it does not already exist.
|
void |
setName(java.lang.String name)
Change the name of the attribute.
|
void |
setType(int type)
Change the type of the tag.
|
java.lang.String |
toString() |
void |
writeTo(SitemeshBufferFragment.Builder buffer,
int position)
Write out the complete tag in its original form, preserving original formatting.
|
private java.lang.String[] attributes
private int attributeCount
private java.lang.String name
private int type
public CustomTag(java.lang.String name, int type)
public CustomTag(Tag tag)
public java.lang.String getContents()
Tag
getContents
in interface Tag
public void writeTo(SitemeshBufferFragment.Builder buffer, int position)
Tag
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public int getAttributeCount()
Tag
getAttributeCount
in interface Tag
public int getAttributeIndex(java.lang.String name, boolean caseSensitive)
Tag
getAttributeIndex
in interface Tag
public java.lang.String getAttributeName(int index)
Tag
getAttributeName
in interface Tag
public java.lang.String getAttributeValue(int index)
Tag
getAttributeValue
in interface Tag
public java.lang.String getAttributeValue(java.lang.String name, boolean caseSensitive)
Tag
getAttributeValue
in interface Tag
public boolean hasAttribute(java.lang.String name, boolean caseSensitive)
Tag
hasAttribute
in interface Tag
public java.lang.String getName()
Tag
public int getType()
public void setName(java.lang.String name)
public void setType(int type)
private void growAttributes()
public int addAttribute(java.lang.String name, java.lang.String value)
name
- Name of attribute to change.value
- New value of attribute or null for an HTML style empty attribute.public void setAttributeValue(java.lang.String name, boolean caseSensitive, java.lang.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, java.lang.String name)
public void setAttributeValue(int attributeIndex, java.lang.String value)
public void removeAttribute(int attributeIndex)
public void removeAttribute(java.lang.String name, boolean caseSensitive)
name
- Name of attribute to remove.caseSensitive
- Whether the name should be treated as case sensitive.public int getPosition()
Tag
getPosition
in interface Tag