Tag
public class CustomTag extends Object implements Tag
Tag
Modifier and Type | Field | Description |
---|---|---|
private int |
attributeCount |
|
private String[] |
attributes |
|
private String |
name |
|
private int |
type |
CLOSE, CLOSE_MAGIC_COMMENT, EMPTY, OPEN, OPEN_MAGIC_COMMENT
Constructor | Description |
---|---|
CustomTag(Tag tag) |
Create a CustomTag based on an existing Tag - this takes a copy of the Tag.
|
CustomTag(String name,
int type) |
Type of tag:
<blah> - Tag.OPEN </blah> - Tag.CLOSE <blah/> - Tag.EMPTY |
Modifier and Type | Method | 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 |
getContents() |
Get the complete tag in its original form, preserving original formatting.
|
String |
getName() |
Name of tag (ie.
|
int |
getType() |
Type of tag:
<blah> - Tag.OPEN </blah> - Tag.CLOSE <blah/> - Tag.EMPTY |
private void |
growAttributes() |
|
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(int type) |
Change the type of the tag.
|
String |
toString() |
|
void |
writeTo(CharArray out) |
Write out the complete tag in its original form, preserving original formatting.
|
private String[] attributes
private int attributeCount
private String name
private int type
public CustomTag(String name, int type)
public CustomTag(Tag tag)
public String getContents()
Tag
getContents
in interface Tag
Tag.writeTo(com.opensymphony.module.sitemesh.html.util.CharArray)
public void writeTo(CharArray out)
Tag
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 int getType()
public void setName(String name)
public void setType(int type)
private void growAttributes()
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.