public NodePointer createNodePointer(NodePointer parent, QName name, Object bean) { return ValueUtils.isCollection(bean) ? new CollectionPointer(parent, bean) : null; } }
public NodePointer createPath(JXPathContext context, Object value) { NodePointer ptr = createPath(context); ptr.setValue(value); return ptr; }
public NodePointer createPath(JXPathContext context) { if (ValueUtils.getLength(getBaseValue()) <= index) { collection = ValueUtils.expandCollection(getNode(), index + 1); } return this; }
public NodePointer getValuePointer() { if (valuePointer == null) { if (index == WHOLE_COLLECTION) { valuePointer = this; } else { Object value = getImmediateNode(); valuePointer = NodePointer.newChildNodePointer(this, getName(), value); } } return valuePointer; }
public NodeIterator namespaceIterator() { return index == WHOLE_COLLECTION ? null : getValuePointer().namespaceIterator(); }
public NodePointer createChild( JXPathContext context, QName name, int index, Object value) { NodePointer ptr = (NodePointer) clone(); ptr.setIndex(index); return ptr.createPath(context, value); }
public int getLength() { return ValueUtils.getLength(getBaseValue()); }
public boolean isLeaf() { Object value = getNode(); return value == null || JXPathIntrospector.getBeanInfo(value.getClass()).isAtomic(); }
public String asPath() { StringBuffer buffer = new StringBuffer(); NodePointer parent = getImmediateParentPointer(); if (parent != null) { buffer.append(parent.asPath()); if (index != WHOLE_COLLECTION) { // Address the list[1][2] case if (parent.getIndex() != WHOLE_COLLECTION) { buffer.append("/."); } buffer.append("[").append(index + 1).append(']'); } } else { if (index != WHOLE_COLLECTION) { buffer.append("/.[").append(index + 1).append(']'); } else { buffer.append("/"); } } return buffer.toString(); } }
public NodePointer namespacePointer(String namespace) { return index == WHOLE_COLLECTION ? null : getValuePointer().namespacePointer(namespace); }
public NodePointer createChild( JXPathContext context, QName name, int index) { NodePointer ptr = (NodePointer) clone(); ptr.setIndex(index); return ptr.createPath(context); }
public NodeIterator childIterator(NodeTest test, boolean reverse, NodePointer startWith) { if (index == WHOLE_COLLECTION) { return new CollectionChildNodeIterator( this, test, reverse, startWith); } return getValuePointer().childIterator(test, reverse, startWith); }
NodePointer ptr = (NodePointer) pointer.clone(); int length = ptr.getLength(); for (int i = 0; i < length; i++) {
public NodePointer createNodePointer(QName name, Object bean, Locale locale) { return ValueUtils.isCollection(bean) ? new CollectionPointer(bean, locale) : null; }
public boolean testNode(NodeTest test) { if (index == WHOLE_COLLECTION) { if (test == null) { return true; } if (test instanceof NodeNameTest) { return false; } return test instanceof NodeTypeTest && ((NodeTypeTest) test).getNodeType() == Compiler.NODE_TYPE_NODE; } return getValuePointer().testNode(test); }
public NodeIterator attributeIterator(QName name) { return index == WHOLE_COLLECTION ? new CollectionAttributeNodeIterator(this, name) : getValuePointer().attributeIterator(name); }