|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.google.javascript.jscomp.jsonml.JsonML
public class JsonML
Class which represents JsonML element according to the specification at "http://code.google.com/p/es-lab/wiki/JsonMLASTFormat"
| Constructor Summary | |
|---|---|
JsonML(TagType type)
Creates a new element with a given type. |
|
JsonML(TagType type,
JsonML... children)
Creates a new element. |
|
JsonML(TagType type,
List<? extends JsonML> children)
|
|
JsonML(TagType type,
Map<? extends TagAttr,?> attributes)
|
|
JsonML(TagType type,
Map<? extends TagAttr,?> attributes,
List<? extends JsonML> children)
|
|
| Method Summary | |
|---|---|
void |
addChild(int index,
JsonML element)
Inserts the given JsonML element at the given position in the list of children. |
void |
appendChild(JsonML element)
Appends a given child element to the list of children. |
void |
appendChildren(Collection<? extends JsonML> elements)
Appends a collection of children to the back of the list of children. |
int |
childrenSize()
Returns number of the children. |
void |
clearChildren()
Removes all elements from the list of children. |
Object |
getAttribute(TagAttr name)
Returns value associated with a given attribute. |
Map<TagAttr,Object> |
getAttributes()
Returns a map with attributes and respective values. |
JsonML |
getChild(int index)
Returns child at a given position. |
List<JsonML> |
getChildren()
Returns a list of all children. |
List<JsonML> |
getChildren(int fromIndex,
int toIndex)
Returns the portion of children list between the specified fromIndex, inclusive, and toIndex, exclusive. |
TagType |
getType()
Returns type of the JsonML element. |
boolean |
hasChildren()
Returns true if the JsonML element has at least one child. |
void |
setAttribute(TagAttr name,
Object value)
Sets value for a given attribute. |
void |
setAttributes(Map<TagAttr,Object> attributes)
Sets attributes of the JsonML element. |
void |
setChild(int index,
JsonML element)
Replaces the element at the given position in the list of children wit the given JsonML element. |
void |
setChildren(JsonML... children)
Replaces all elements in the list of children with the given JsonML elements. |
void |
setChildren(List<JsonML> children)
Replaces all elements in the list of children with the given list of JsonML elements.. |
String |
toString()
|
String |
toStringTree()
Prints a JsonML tree in a human readable format. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public JsonML(TagType type)
type -
public JsonML(TagType type,
JsonML... children)
type - type of the elementchildren - children to append to the element
public JsonML(TagType type,
List<? extends JsonML> children)
public JsonML(TagType type,
Map<? extends TagAttr,?> attributes)
public JsonML(TagType type,
Map<? extends TagAttr,?> attributes,
List<? extends JsonML> children)
| Method Detail |
|---|
public void addChild(int index,
JsonML element)
index - index at which the given element is to be insertedelement - JsonML element to be insertedpublic void appendChild(JsonML element)
element - JsonML element to appendpublic void appendChildren(Collection<? extends JsonML> elements)
elements - collection of JsonML elements to appendpublic int childrenSize()
public void clearChildren()
public Object getAttribute(TagAttr name)
name - name of the attribute
public Map<TagAttr,Object> getAttributes()
public JsonML getChild(int index)
public List<JsonML> getChildren()
public List<JsonML> getChildren(int fromIndex,
int toIndex)
fromIndex - low endpoint (inclusive)toIndex - high endpoint (exclusive)public TagType getType()
public boolean hasChildren()
public void setAttribute(TagAttr name,
Object value)
name - name of the attributevalue - value to associate with the attributepublic void setAttributes(Map<TagAttr,Object> attributes)
attributes - map with attributes and their values
public void setChild(int index,
JsonML element)
index - index of element to replaceelement - JsonML element to appendpublic void setChildren(JsonML... children)
children - a comma separated list of JsonML elementspublic void setChildren(List<JsonML> children)
children - a list of JsonML elements.public String toString()
toString in class Objectpublic String toStringTree()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||