Example usage for org.apache.commons.jxpath JXPathContext getFactory

List of usage examples for org.apache.commons.jxpath JXPathContext getFactory

Introduction

In this page you can find the example usage for org.apache.commons.jxpath JXPathContext getFactory.

Prototype

public AbstractFactory getFactory() 

Source Link

Document

Returns the AbstractFactory installed on this context.

Usage

From source file:org.eclipse.e4.emf.internal.xpath.NullEStructuralFeaturePointer.java

@Override
public NodePointer createPath(JXPathContext context) {
    NodePointer newParent = parent.createPath(context);
    if (isAttribute()) {
        return newParent.createAttribute(context, getName());
    }/*  w w  w  .j  a  v a 2s . c om*/
    if (parent instanceof NullPointer && parent.equals(newParent)) {
        throw createBadFactoryException(context.getFactory());
    }
    // Consider these two use cases:
    // 1. The parent pointer of NullPropertyPointer is
    //    a PropertyOwnerPointer other than NullPointer. When we call
    //    createPath on it, it most likely returns itself. We then
    //    take a PropertyPointer from it and get the PropertyPointer
    //    to expand the collection for the corresponding property.
    //
    // 2. The parent pointer of NullPropertyPointer is a NullPointer.
    //    When we call createPath, it may return a PropertyOwnerPointer
    //    or it may return anything else, like a DOMNodePointer.
    //    In the former case we need to do exactly what we did in use
    //    case 1.  In the latter case, we simply request that the
    //    non-property pointer expand the collection by itself.
    if (newParent instanceof EStructuralFeatureOwnerPointer) {
        EStructuralFeatureOwnerPointer pop = (EStructuralFeatureOwnerPointer) newParent;
        newParent = pop.getPropertyPointer();
    }
    return newParent.createChild(context, getName(), getIndex());
}

From source file:org.eclipse.e4.emf.internal.xpath.NullEStructuralFeaturePointer.java

@Override
public NodePointer createPath(JXPathContext context, Object value) {
    NodePointer newParent = parent.createPath(context);
    if (isAttribute()) {
        NodePointer pointer = newParent.createAttribute(context, getName());
        pointer.setValue(value);/*from ww  w. j av a2s  .  com*/
        return pointer;
    }
    if (parent instanceof NullPointer && parent.equals(newParent)) {
        throw createBadFactoryException(context.getFactory());
    }
    if (newParent instanceof EStructuralFeatureOwnerPointer) {
        EStructuralFeatureOwnerPointer pop = (EStructuralFeatureOwnerPointer) newParent;
        newParent = pop.getPropertyPointer();
    }
    return newParent.createChild(context, getName(), index, value);
}