|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.inria.ns.reflex.xml.operator.AbstractXOperator
public abstract class AbstractXOperator
The X-operator of an X-operable object allows to perform XML updates operations and XPath navigation on this object. This implementation is a skeleton implementation of X-operable objects, that should override methods that are supported by theses objects.
| Constructor Summary | |
|---|---|
AbstractXOperator(XFactory factory)
Default Constructor. |
|
| Method Summary | |
|---|---|
void |
append(int referent,
Object parent,
Object operand)
Throws an exception if not overriden. |
void |
append(Object referent,
Object operand)
Throws an exception if not overriden. |
boolean |
booleanValueOf(Object referent)
This implementation returns the boolean value of the referent based on its string value. |
void |
clear(int referent,
Object parent)
Throws an exception if not overriden. |
void |
clear(Object referent)
Throws an exception if not overriden. |
void |
clearAll(int referent,
Object parent)
Throws an exception if not overriden. |
void |
clearAll(Object referent)
Throws an exception if not overriden. |
Object |
clone(int referent,
Object parent)
Throws an exception if not overriden. |
Object |
clone(Object referent)
Throws an exception if not overriden. |
Object |
getAttributeValue(Object referent,
QName attribute)
Returns the attribute value hosted by the given referent object. |
Object |
getCommentAt(Object referent,
int index)
Return the child comment at the position specified. |
Object |
getElementAt(Object referent,
int index)
This default implementation return the element at the position specified from the list of children. |
Object |
getElementById(QName id,
Object referent)
This default implementation return null. |
Iterator |
getElementsByName(Object referent,
QName name)
Return the children elements that have the given name. |
int |
getFamilyIndex(Object referent)
Return the intrinsic position of this item amongs items of the same family ; for an element <f:foo>, the XPath pattern f:*[n] would use this method in order to test its position. |
int |
getFamilySize(Object referent)
Return the intrinsic size of the referent's collection of items of the same family ; for an element <f:foo>, the XPath pattern f:*[last()] would use this method in order to test its position. |
int |
getIndex(Object referent)
Return the intrinsic position of this item ; for an element <foo>, the XPath pattern node()[n] would use this method in order to test its position. |
Object |
getNamedElementAt(Object referent,
int index,
QName qname)
Return the child element at the position specified with a specific name. |
Object |
getNamedProcessingInstructionAt(Object referent,
int index,
QName target)
Return the child processing instruction at the position specified with a specific target. |
int |
getNameIndex(Object referent)
Return the intrinsic position of this item amongs items of the same name ; for an element <foo>, the XPath pattern foo[n] would use this method in order to test its position. |
int |
getNameSize(Object referent)
Return the intrinsic size of the referent's collection of items of the same name ; for an element <foo>, the XPath pattern foo[last()] would use this method in order to test its position. |
Map |
getNamespaces(Object referent)
Return the namespaces defined explicitely by the referent object. |
Object |
getNext(Object referent)
Return the next object. |
Object |
getNodeAt(Object referent,
int index)
This default implementation return the item at the position specified from the list of children. |
String |
getNodeKind(Object referent)
This implementation is based on the isXXX() methods. |
short |
getNodeType(Object referent)
Usually, an X-operable object that is not a node behaves like an element. |
Object |
getParent(Object referent)
Return the parent of the referent object. |
Object |
getPrevious(Object referent)
Return the previous object. |
Object |
getProcessingInstructionAt(Object referent,
int index)
Return the child processing instruction at the position specified. |
QName |
getQName(Object referent)
Return the qualified name of the referent object if any, or null. |
Object |
getRoot(Object referent)
This implementation lookup for the root in the hierarchy by invoking successively the parents. |
int |
getSize(Object referent)
Return the intrinsic size of an object. |
String |
getStringAttributeValue(Object referent,
QName attribute)
Returns the string attribute value hosted by the given referent object. |
String |
getStringName(Object referent)
Retrieve the string name of the referent object if any, or "". |
Object |
getTextAt(Object referent,
int index)
Return the child text at the position specified. |
Type |
getType(Object referent)
Return the type of the object. |
int |
getTypeIndex(Object referent)
Return the intrinsic position of this item amongs items of the same type ; for an element <foo>, the XPath pattern *[n] would use this method in order to test its position. |
int |
getTypeSize(Object referent)
Return the intrinsic size of the referent's collection of items of the same type ; for an element <foo>, the XPath pattern *[last()] would use this method in order to test its position. |
Object |
getValue(Object referent)
Retrieve the value of the referent object, or null. |
XFactory |
getXFactory()
Return the factory that built this X-operator. |
short |
getXMLType(Object referent)
Get the XML type of the referent. |
XOperator |
getXOperator()
Return the X-operator of this object. |
void |
insertAfter(int referent,
Object parent,
Object operand)
Throws an exception if not overriden. |
void |
insertAfter(Object referent,
Object parent,
Object operand)
Throws an exception if not overriden. |
void |
insertBefore(int referent,
Object parent,
Object operand)
Throws an exception if not overriden. |
void |
insertBefore(Object referent,
Object parent,
Object operand)
Throws an exception if not overriden. |
boolean |
isAttribute(Object referent)
|
boolean |
isComment(Object referent)
|
boolean |
isDocument(Object referent)
|
boolean |
isElement(Object referent)
|
boolean |
isParentNode(Object referent)
Indicate if the referent is a parent node, that is to say if it can have children. |
boolean |
isProcessingInstruction(Object referent)
|
boolean |
isText(Object referent)
|
Number |
numberValueOf(Object referent)
This implementation returns the number value of the referent based on its string value. |
void |
remove(int referent,
Object parent)
Throws an exception if not overriden. |
void |
remove(Object referent,
Object parent)
Throws an exception if not overriden. |
boolean |
removeAttribute(Object referent,
QName attribute)
Removes an attribute hosted by the given referent object. |
void |
rename(int referent,
Object parent,
QName newName)
Throws an exception if not overriden. |
void |
rename(Object referent,
Object parent,
QName newName)
Throws an exception if not overriden. |
void |
replace(int referent,
Object parent,
Object operand)
Throws an exception if not overriden. |
void |
replace(Object referent,
Object parent,
Object operand)
Throws an exception if not overriden. |
void |
setAttribute(Object referent,
QName attribute,
Object value)
Sets the attribute value hosted by the given referent object. |
String |
stringValueOf(Object referent)
This implementation returns the string value of the referent. |
void |
update(int referent,
Object parent,
Object value)
Throws an exception if not overriden. |
void |
update(Object referent,
Object value)
Throws an exception if not overriden. |
Object |
valueOf(Object referent)
This implementation returns the referent object itself. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.inria.ns.reflex.xml.operator.XOperator |
|---|
getAttributes, getChildren, getTypeName |
| Constructor Detail |
|---|
public AbstractXOperator(XFactory factory)
| Method Detail |
|---|
public XFactory getXFactory()
getXFactory in interface XOperatorpublic XOperator getXOperator()
public Object getParent(Object referent)
The parent returned is not the structural parent of the object, but the functional parent ; for example, if a component stores its attributes in a Map, the parent of an attribute of the component is not the Map that hold the attributes but the component itself.
getParent in interface XOperatorreferent - The referent object.
public Object getNext(Object referent)
getNext in interface XOperatorreferent - The referent object.
public Object getPrevious(Object referent)
getPrevious in interface XOperatorreferent - The referent object.
public Type getType(Object referent)
getType in interface XOperatorreferent - The referent object.
public Map getNamespaces(Object referent)
This default implementation build the namespace set from the attributes which name is bound to the XMLNS namespace URI. The QName keeps the form of the original attribute, that is to say xmlns:prefix or xmlns.
If the referent defines xmlns="" (cancelling the default namespace), it will be present in this result map, but must be removed in the in-scope namespaces of the referent.
getNamespaces in interface XOperatorreferent - The referent object.
null map of {QName, ChildItem}.XMLNames.XMLNS_NAMESPACE_URI,
QName,
ChildItem,
XMaster.getInScopeNamespaces(Object),
XMaster.extractNamespaces(Map)public QName getQName(Object referent)
getQName in interface XOperatorreferent - The referent object.
public String getStringName(Object referent)
getStringName in interface XOperatorreferent - The referent object.
public Object getValue(Object referent)
getValue in interface XOperatorreferent - The referent object.
public short getNodeType(Object referent)
getNodeType in interface XOperatorreferent - The referent object.
XType.ELEMENT_NODE
public Object getAttributeValue(Object referent,
QName attribute)
getAttributeValue in interface XOperatorreferent - The referent object.attribute - The name of the attribute.
public String getStringAttributeValue(Object referent,
QName attribute)
getStringAttributeValue in interface XOperatorreferent - The referent object.attribute - The name of the attribute.
public void setAttribute(Object referent,
QName attribute,
Object value)
throws UnsupportedOperationException
setAttribute in interface XOperatorreferent - The referent object.attribute - The name of the attribute.value - The value of the attribute.
UnsupportedOperationException - When the operation is not
supported.
public boolean removeAttribute(Object referent,
QName attribute)
removeAttribute in interface XOperatorreferent - The referent object.attribute - The name of the attribute to remove.
public void append(Object referent,
Object operand)
throws UnsupportedOperationException
append in interface XOperatorreferent - The referent object to append to.operand - The object to append.
UnsupportedOperationException - When the operation is not
supported.
public void append(int referent,
Object parent,
Object operand)
throws UnsupportedOperationException
append in interface XOperatorreferent - The position of the referent object to append to.parent - The non null parent object of the referent.operand - The object to append.
UnsupportedOperationException - When the operation is not
supported.
public void clear(Object referent)
throws UnsupportedOperationException
clear in interface XOperatorreferent - The referent object to clear.
UnsupportedOperationException - When the operation is not
supported.
public void clear(int referent,
Object parent)
throws UnsupportedOperationException
clear in interface XOperatorreferent - The position of the referent object to append to.parent - The non null parent object of the referent.
UnsupportedOperationException - When the operation is not
supported.
public void clearAll(Object referent)
throws UnsupportedOperationException
clearAll in interface XOperatorreferent - The referent object to clear all.
UnsupportedOperationException - When the operation is not
supported.
public void clearAll(int referent,
Object parent)
throws UnsupportedOperationException
clearAll in interface XOperatorreferent - The position of the referent object to append to.parent - The non null parent object of the referent.
UnsupportedOperationException - When the operation is not
supported.
public Object clone(Object referent)
throws UnsupportedOperationException
clone in interface XOperatorreferent - The referent object to clone.
UnsupportedOperationException - When the operation is not
supported.
public Object clone(int referent,
Object parent)
throws UnsupportedOperationException
clone in interface XOperatorreferent - The position of the referent object to clone.parent - The non null parent object of the referent.
UnsupportedOperationException - When the operation is not
supported.
public void insertAfter(Object referent,
Object parent,
Object operand)
throws UnsupportedOperationException
insertAfter in interface XOperatorreferent - The referent object where to insert after.parent - The parent object of the referent, or null if
the referent is able to retrieve it by itself.operand - The object to insert.
UnsupportedOperationException - When the operation is not
supported.
public void insertAfter(int referent,
Object parent,
Object operand)
throws UnsupportedOperationException
insertAfter in interface XOperatorreferent - The position of the referent object where to insert after.parent - The non null parent object of the referent.operand - The object to insert.
UnsupportedOperationException - When the operation is not
supported.
public void insertBefore(Object referent,
Object parent,
Object operand)
throws UnsupportedOperationException
insertBefore in interface XOperatorreferent - The referent object where to insert before.parent - The parent object of the referent, or null if
the referent is able to retrieve it by itself.operand - The object to insert.
UnsupportedOperationException - When the operation is not
supported.
public void insertBefore(int referent,
Object parent,
Object operand)
throws UnsupportedOperationException
insertBefore in interface XOperatorreferent - The position of the referent object where to insert
before.parent - The non null parent object of the referent.operand - The object to insert.
UnsupportedOperationException - When the operation is not
supported.
public void remove(Object referent,
Object parent)
throws UnsupportedOperationException
remove in interface XOperatorreferent - The referent object to remove.parent - The parent object of the referent, or null if
the referent is able to retrieve it by itself.
UnsupportedOperationException - If not overriden, this operation
is not supported.
public void remove(int referent,
Object parent)
throws UnsupportedOperationException
remove in interface XOperatorreferent - The position of the referent object to remove.parent - The non null parent object of the referent.
UnsupportedOperationException - If not overriden, this operation
is not supported.
public void rename(Object referent,
Object parent,
QName newName)
throws UnsupportedOperationException
rename in interface XOperatorreferent - The referent object to rename.parent - The parent object of the referent, or null if
the referent is able to retrieve it by itself or may be
renamed without involving its parent.newName - The new name of the referent object. If the referent
object only support String, the QName should be built with
an NCName.
UnsupportedOperationException - When the operation is not
supported.
public void rename(int referent,
Object parent,
QName newName)
throws UnsupportedOperationException
rename in interface XOperatorreferent - The position of the referent object to rename.parent - The non null parent object of the referent.newName - The new name of the referent object. If the referent
object only support String, the QName should be built with
an NCName.
UnsupportedOperationException - When the operation is not
supported.
public void replace(Object referent,
Object parent,
Object operand)
throws UnsupportedOperationException
replace in interface XOperatorreferent - The referent object to replace.parent - The parent object of the referent, or null if
the referent is able to retrieve it by itself.operand - The object that will replace the referent object.
UnsupportedOperationException - When the operation is not
supported.
public void replace(int referent,
Object parent,
Object operand)
throws UnsupportedOperationException
replace in interface XOperatorreferent - The position of the referent object to replace.parent - The non null parent object of the referent.operand - The object that will replace the referent object.
UnsupportedOperationException - When the operation is not
supported.
public void update(Object referent,
Object value)
throws UnsupportedOperationException
update in interface XOperatorreferent - The position of the referent object to update.value - The new value of the referent.
UnsupportedOperationException - When the operation is not
supported.
public void update(int referent,
Object parent,
Object value)
throws UnsupportedOperationException
update in interface XOperatorreferent - The referent object to update.parent - The parent object of the referent, or null if
the referent is able to retrieve it by itself or may be
renamed without involving its parent.value - The new value of the referent.
UnsupportedOperationException - When the operation is not
supported.
public Object getElementById(QName id,
Object referent)
null.
getElementById in interface XOperatorid - The ID.referent - The referent.
null
public Iterator getElementsByName(Object referent,
QName name)
XOperator.getChildren(Object)
getElementsByName in interface XOperatorreferent - The referent.name - The name.
null iterator on the elements that has the name given.
public Object getElementAt(Object referent,
int index)
getElementAt in interface XOperatorreferent - The parent node.index - The index.
null.XOperator.getChildren(Object),
XOperator.isElement(Object)
public Object getNodeAt(Object referent,
int index)
getNodeAt in interface XOperatorreferent - The parent node.index - The index.
null.XOperator.getChildren(Object)
public Object getTextAt(Object referent,
int index)
XOperator
getTextAt in interface XOperatorreferent - The parent node.index - The index.
null.
public Object getCommentAt(Object referent,
int index)
XOperator
getCommentAt in interface XOperatorreferent - The parent node.index - The index.
null.
public Object getProcessingInstructionAt(Object referent,
int index)
XOperator
getProcessingInstructionAt in interface XOperatorreferent - The parent node.index - The index.
null.
public Object getNamedElementAt(Object referent,
int index,
QName qname)
XOperator
getNamedElementAt in interface XOperatorreferent - The parent node.index - The index.qname - The name of the element to count.
null.
public Object getNamedProcessingInstructionAt(Object referent,
int index,
QName target)
XOperator
getNamedProcessingInstructionAt in interface XOperatorreferent - The parent node.index - The index.target - The target of the PI to count, as an NCName.
null.public boolean isDocument(Object referent)
isDocument in interface XOperatorreferent -
public boolean isElement(Object referent)
isElement in interface XOperatorreferent -
public boolean isAttribute(Object referent)
isAttribute in interface XOperatorreferent -
public boolean isText(Object referent)
isText in interface XOperatorreferent -
public boolean isComment(Object referent)
isComment in interface XOperatorreferent -
public boolean isProcessingInstruction(Object referent)
isProcessingInstruction in interface XOperatorreferent -
public short getXMLType(Object referent)
getXMLType in interface XOperatorXTypepublic String getNodeKind(Object referent)
getNodeKind in interface XOperatorpublic boolean isParentNode(Object referent)
isParentNode in interface XOperatorreferent - The referent.
true if it is an element or a document,
false otherwise.XOperator.isElement(Object),
XOperator.isDocument(Object)public String stringValueOf(Object referent)
stringValueOf in interface XOperatorreferent - The referent.
Object.toString()public Number numberValueOf(Object referent)
numberValueOf in interface XOperatorreferent - The referent.
stringValueOf(Object),
NumberOperator.parseNumber(String)public boolean booleanValueOf(Object referent)
booleanValueOf in interface XOperatorreferent - The referent.
stringValueOf(Object)public Object valueOf(Object referent)
valueOf in interface XOperatorreferent - The referent.
public Object getRoot(Object referent)
getRoot in interface XOperatorreferent - An item in the hierarchy.
null if the referent
is not in a hierarchy or is unreachable.getParent(Object)public int getIndex(Object referent)
getIndex in interface XOperatorreferent - The referent object.
#getNaturalSize(Object),
getTypeIndex(Object),
getFamilyIndex(Object),
getNameIndex(Object)public int getSize(Object referent)
getSize in interface XOperatorreferent - The referent object.
#getNaturalIndex(Object),
getTypeSize(Object),
getFamilySize(Object),
getNameSize(Object)public int getTypeIndex(Object referent)
getTypeIndex in interface XOperatorreferent - The referent object.
public int getTypeSize(Object referent)
XOperator
getTypeSize in interface XOperatorreferent -
public int getFamilyIndex(Object referent)
getFamilyIndex in interface XOperatorreferent - The referent object.
public int getFamilySize(Object referent)
XOperator
getFamilySize in interface XOperatorreferent -
public int getNameIndex(Object referent)
getNameIndex in interface XOperatorreferent - The referent object.
public int getNameSize(Object referent)
XOperator
getNameSize in interface XOperatorreferent -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||