Package io.keikai.doc.collab.types
Class YXmlElement<T>
- java.lang.Object
-
- io.keikai.doc.collab.types.AbstractType<YXmlEvent>
-
- io.keikai.doc.collab.types.YXmlFragment<T>
-
- io.keikai.doc.collab.types.YXmlElement<T>
-
public class YXmlElement<T> extends YXmlFragment<T>
-
-
Field Summary
-
Fields inherited from class io.keikai.doc.collab.types.AbstractType
_doc, _length, _map, _searchMarker
-
-
Constructor Summary
Constructors Constructor Description YXmlElement()Constructor for YXmlElement.YXmlElement(java.lang.String nodeName)Constructor for YXmlElement.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description YXmlElementclone()Makes a copy of this data type that can be included somewhere else.YXmlElementcopy()Creates an Item with the same effect as this Item (without position effect).java.lang.ObjectgetAttribute(java.lang.String attributeName)Returns an attribute value that belongs to the attribute name.java.util.Map<java.lang.String,java.lang.Object>getAttributes()Returns all attribute name/value pairs in a JSON Object.java.util.Map<java.lang.String,java.lang.Object>getAttributes(Snapshot snapshot)Returns all attribute name/value pairs in a JSON Object.AbstractTypegetNextSibling()java.lang.StringgetNodeName()java.util.Map<java.lang.String,java.lang.Object>getPrelimAttrs()AbstractTypegetPrevSibling()booleanhasAttribute(java.lang.String attributeName)Returns whether an attribute exists.voidintegrate(Doc y, Item item)Integrate this type into the Yjs instance.static YXmlElementreadYXmlElement(UpdateDecoder decoder)Static method to read a YXmlElement from a decoder.voidremoveAttribute(java.lang.String attributeName)Removes an attribute from this YXmlElement.<T> voidsetAttribute(java.lang.String attributeName, T attributeValue)Sets or updates an attribute.voidsetNodeName(java.lang.String nodeName)java.lang.StringtoString()Returns the XML serialization of this YXmlElement.voidwrite(UpdateEncoder encoder)Transform the properties of this type to binary and write it to a BinaryEncoder.-
Methods inherited from class io.keikai.doc.collab.types.YXmlFragment
callObserver, createTreeWalker, delete, delete, forEach, get, getFirstChild, insert, insertAfter, length, push, querySelector, querySelectorAll, readYXmlFragment, slice, toArray, toJSON, toList, unshift
-
Methods inherited from class io.keikai.doc.collab.types.AbstractType
callTypeObservers, createMapIterator, getDeepEventHandler, getDoc, getFirst, getItem, getMap, getParent, getSearchMarker, getStart, getTypeChildren, isParentOf, observe, observe, observeDeep, setLength, setMap, setStart, typeListCreateIterator, typeListDelete, typeListForEach, typeListForEachSnapshot, typeListGet, typeListInsertGenerics, typeListInsertGenericsAfter, typeListMap, typeListPushGenerics, typeListSlice, typeListToArray, typeListToArraySnapshot, typeMapDelete, typeMapGet, typeMapGetAll, typeMapGetAllSnapshot, typeMapGetSnapshot, typeMapHas, typeMapSet, unobserve, unobserveDeep
-
-
-
-
Method Detail
-
getNodeName
public java.lang.String getNodeName()
-
setNodeName
public void setNodeName(java.lang.String nodeName)
-
getPrelimAttrs
public java.util.Map<java.lang.String,java.lang.Object> getPrelimAttrs()
-
getNextSibling
public AbstractType getNextSibling()
- Returns:
- YXmlElement or YXmlText|null - The next sibling.
-
getPrevSibling
public AbstractType getPrevSibling()
- Returns:
- YXmlElement or YXmlText|null - The previous sibling.
-
integrate
public void integrate(Doc y, Item item)
Integrate this type into the Yjs instance.- Overrides:
integratein classYXmlFragment<T>- Parameters:
y- The Yjs instance.item- The item to integrate.
-
copy
public YXmlElement copy()
Creates an Item with the same effect as this Item (without position effect).- Overrides:
copyin classYXmlFragment<T>- Returns:
- YXmlElement
-
clone
public YXmlElement clone()
Makes a copy of this data type that can be included somewhere else.Note that the content is only readable _after_ it has been included somewhere in the Ydoc.
- Overrides:
clonein classYXmlFragment<T>- Returns:
- YXmlElement
-
toString
public java.lang.String toString()
Returns the XML serialization of this YXmlElement. The attributes are ordered by attribute-name, so you can easily use this method to compare YXmlElements.- Overrides:
toStringin classYXmlFragment<T>- Returns:
- String The string representation of this type.
-
removeAttribute
public void removeAttribute(java.lang.String attributeName)
Removes an attribute from this YXmlElement.- Parameters:
attributeName- The attribute name that is to be removed.
-
setAttribute
public <T> void setAttribute(java.lang.String attributeName, T attributeValue)Sets or updates an attribute.- Parameters:
attributeName- The attribute name that is to be set.attributeValue- The attribute value that is to be set.
-
getAttribute
public java.lang.Object getAttribute(java.lang.String attributeName)
Returns an attribute value that belongs to the attribute name.- Parameters:
attributeName- The attribute name that identifies the queried value.- Returns:
- The queried attribute value.
-
hasAttribute
public boolean hasAttribute(java.lang.String attributeName)
Returns whether an attribute exists.- Parameters:
attributeName- The attribute name to check for existence.- Returns:
- boolean - Whether the attribute exists.
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
Returns all attribute name/value pairs in a JSON Object.- Returns:
- A JSON Object (Map) that describes the attributes.
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes(Snapshot snapshot)
Returns all attribute name/value pairs in a JSON Object.- Parameters:
snapshot- Optional snapshot parameter.- Returns:
- A JSON Object (Map) that describes the attributes.
-
write
public void write(UpdateEncoder encoder)
Transform the properties of this type to binary and write it to a BinaryEncoder.This is called when this Item is sent to a remote peer.
- Overrides:
writein classYXmlFragment<T>- Parameters:
encoder- The encoder to write data to.
-
readYXmlElement
public static YXmlElement readYXmlElement(UpdateDecoder decoder)
Static method to read a YXmlElement from a decoder.- Parameters:
decoder- The decoder to read data from.- Returns:
- A new YXmlElement instance.
-
-