org.apache.commons.jxpath.ri.JXPathContextReferenceImpl Java Examples

The following examples show how to use org.apache.commons.jxpath.ri.JXPathContextReferenceImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestXPathExpressionEngine.java    From commons-configuration with Apache License 2.0 6 votes vote down vote up
/**
 * Tests if the JXPathContext is correctly initialized with the node pointer
 * factory.
 */
@Test
public void testNodePointerFactory()
{
    JXPathContext.newContext(this);
    final NodePointerFactory[] factories =
            JXPathContextReferenceImpl.getNodePointerFactories();
    boolean found = false;
    for (final NodePointerFactory factory : factories)
    {
        if (factory instanceof ConfigurationNodePointerFactory)
        {
            found = true;
        }
    }
    assertTrue("No configuration pointer factory found", found);
}
 
Example #2
Source File: NodePointer.java    From commons-jxpath with Apache License 2.0 6 votes vote down vote up
/**
 * Allocates an new child NodePointer by iterating through all installed
 * NodePointerFactories until it finds one that can create a pointer.
 * @param parent pointer
 * @param name QName
 * @param bean Object
 * @return NodePointer
 */
public static NodePointer newChildNodePointer(
    NodePointer parent,
    QName name,
    Object bean) {
    NodePointerFactory[] factories =
        JXPathContextReferenceImpl.getNodePointerFactories();
    for (int i = 0; i < factories.length; i++) {
        NodePointer pointer =
            factories[i].createNodePointer(parent, name, bean);
        if (pointer != null) {
            return pointer;
        }
    }
    throw new JXPathException(
        "Could not allocate a NodePointer for object of "
            + bean.getClass());
}
 
Example #3
Source File: RootContext.java    From commons-jxpath with Apache License 2.0 5 votes vote down vote up
/**
 * Create a new RootContext.
 * @param jxpathContext context
 * @param pointer pointer
 */
public RootContext(JXPathContextReferenceImpl jxpathContext,
        NodePointer pointer) {
    super(null);
    this.jxpathContext = jxpathContext;
    this.pointer = pointer;
    if (pointer != null) {
        pointer.setNamespaceResolver(jxpathContext.getNamespaceResolver());
    }
}
 
Example #4
Source File: LazyDynaBeanTest.java    From commons-jxpath with Apache License 2.0 5 votes vote down vote up
public void testStrictLazyDynaBeanPropertyFactory() {
    JXPathContextReferenceImpl.addNodePointerFactory(new StrictLazyDynaBeanPointerFactory());
    try {
        testLazyProperty();
        fail();
    } catch (JXPathNotFoundException e) {
        //okay
    }
}
 
Example #5
Source File: TestConfigurationNodePointerFactory.java    From commons-configuration with Apache License 2.0 4 votes vote down vote up
@BeforeClass
public static void setUpBeforeClass() throws Exception
{
    JXPathContextReferenceImpl
            .addNodePointerFactory(new ConfigurationNodePointerFactory());
}