Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.jxpath
Class AbstractFactory

    java.lang.Object
      org.apache.commons.jxpath.AbstractFactory

    public abstract class AbstractFactory

extends Object

The `JXPathContext.createPath()` method of JXPathContext can create missing objects as it traverses an XPath; it utilizes an AbstractFactory for that purpose. Install a factory on JXPathContext by calling `JXPathContext. setFactory()`.

All methods of this class return false. Override any of them to return true to indicate that the factory has successfully created the described object.

Version:
  $Revision: 652845 $ $Date: 2008-05-02 12:46:46 -0500 (Fri, 02 May 2008) $
Author:
  Dmitri Plotnikov

Constructor Summary
`AbstractFactory()`

Method Summary
`boolean` | `createObject(JXPathContext context, Pointer pointer, Object parent, String name, int index)` The parameters may describe a collection element or an individual object.
`boolean` | `declareVariable(JXPathContext context, String name)` Declare the specified variable

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractFactory

    public AbstractFactory()

Method Detail

### createObject

    public boolean createObject(JXPathContext context,
                                Pointer pointer,
                                Object parent,
                                String name,
                                int index)

  The parameters may describe a collection element or an individual object. It is up to the factory to infer which one it is. If it is a collection, the factory should check if the collection exists. If not, it should create the collection. Then it should create the index'th element of the collection and return true.

  Parameters:
    `context` - can be used to evaluate other XPaths, get to variables etc.
    `pointer` - describes the location of the node to be created
    `parent` - is the object that will serve as a parent of the new object
    `name` - is the name of the child of the parent that needs to be created. In the case of DOM may be qualified.
    `index` - is used if the pointer represents a collection element. You may need to expand or even create the collection to accommodate the new element.
  Returns:
    true if the object was successfully created

### declareVariable

    public boolean declareVariable(JXPathContext context,
                                   String name)

  Declare the specified variable

  Parameters:
    `context` - hosts variable pools. See `JXPathContext.getVariables()`
    `name` - is the name of the variable without the "$" sign
  Returns:
    true if the variable was successfully defined

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2008 The Apache Software Foundation. All Rights Reserved.