public class CotDetail
extends java.lang.Object
implements android.os.Parcelable
Modifier and Type | Field and Description |
---|---|
static android.os.Parcelable.Creator<CotDetail> |
CREATOR |
Constructor and Description |
---|
CotDetail()
Create a default detail tag
|
CotDetail(CotDetail d)
Copy Constructor.
|
CotDetail(android.os.Parcel source)
Create a detail tag from its Parcel representation
|
CotDetail(java.lang.String elementName)
Create a detail tag with a element name
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(CotDetail detail)
Add a sub detail tag.
|
void |
buildXml(java.lang.Appendable b)
Build the XML representation of the detail tag
|
void |
buildXml(java.lang.StringBuffer b) |
void |
buildXml(java.lang.StringBuilder b) |
int |
childCount()
The number of sub tags in this detail tag
|
void |
clearAttributes()
Remove all attributes
|
int |
describeContents() |
java.lang.String |
getAttribute(java.lang.String name)
Get an attribute by name
|
int |
getAttributeCount()
Get the number of attributes in the tag
|
CotAttribute[] |
getAttributes()
Get an array of the immutable attributes of the detail tag.
|
CotDetail |
getChild(int index)
Get a child detail tag at a given index or null if the index is invalid at the time of the
call.
|
CotDetail |
getChild(java.lang.String name)
Get the first child detail with the given name
This is a shortcut method for
getFirstChildByName(int, String)
which is more verbose |
java.util.List<CotDetail> |
getChildren()
Get a list of this CoT's children
This is much faster than calling
getChild(int) in a loop |
java.util.List<CotDetail> |
getChildrenByName(java.lang.String name)
Get all children details with a matching element name
|
java.lang.String |
getElementName()
Get the tag element name
|
CotDetail |
getFirstChildByName(int startIndex,
java.lang.String childElementName)
Get the first sub tag of a certain name starting at some index or null if the childElement is
not found or the startIndex is out of bounds.
|
java.lang.String |
getInnerText()
Get the inner text of the tag if any.
|
java.lang.String |
removeAttribute(java.lang.String name)
Remove an attribute.
|
void |
removeChild(CotDetail detail)
Remove a child.
|
void |
setAttribute(java.lang.String name,
java.lang.String value)
Set an attribute.
|
void |
setChild(int index,
CotDetail detail)
Set a sub detail tag
|
void |
setElementName(java.lang.String name)
Set the element name of the tag
|
void |
setInnerText(java.lang.String text)
Set the inner text of this tag.
|
java.lang.String |
toString() |
void |
writeToParcel(android.os.Parcel dest,
int flags) |
public static final android.os.Parcelable.Creator<CotDetail> CREATOR
public CotDetail()
public CotDetail(CotDetail d)
public CotDetail(java.lang.String elementName)
elementName
- the element namepublic CotDetail(android.os.Parcel source)
source
- the parcel to extract out the CoT detail.public java.lang.String getElementName()
public java.lang.String getAttribute(java.lang.String name)
name
- attribute namepublic java.lang.String getInnerText()
public CotAttribute[] getAttributes()
public java.lang.String toString()
toString
in class java.lang.Object
public int childCount()
public CotDetail getChild(int index)
index
- public CotDetail getChild(java.lang.String name)
getFirstChildByName(int, String)
which is more verbosename
- Detail namepublic java.util.List<CotDetail> getChildren()
getChild(int)
in a looppublic java.util.List<CotDetail> getChildrenByName(java.lang.String name)
name
- Element namepublic void setAttribute(java.lang.String name, java.lang.String value)
name
- the attribute namevalue
- the valuepublic java.lang.String removeAttribute(java.lang.String name)
name
- the attribute name (can be anything)public void clearAttributes()
public void setElementName(java.lang.String name)
name
- java.lang.IllegalArgumentException
- if the attribute name is not a legal XML namepublic void addChild(CotDetail detail)
detail
- java.lang.IllegalArgumentException
- if detail is nullpublic void setChild(int index, CotDetail detail)
index
- detail
- java.lang.IllegalArgumentException
- if detail is nulljava.lang.ArrayIndexOutOfBoundsException
- if index is out of boundspublic void removeChild(CotDetail detail)
public void setInnerText(java.lang.String text)
text
- public CotDetail getFirstChildByName(int startIndex, java.lang.String childElementName)
startIndex
- the start indexchildElementName
- the element namepublic void buildXml(java.lang.StringBuffer b)
public void buildXml(java.lang.StringBuilder b)
public void buildXml(java.lang.Appendable b) throws java.io.IOException
b
- the appendable to use when generating the xml.java.io.IOException
public int getAttributeCount()
public int describeContents()
describeContents
in interface android.os.Parcelable
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable