View Javadoc

1   /*
2    * Copyright 1999-2004 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.commons.jxpath.ri.model;
17  
18  import java.util.Locale;
19  
20  import org.apache.commons.jxpath.ri.QName;
21  
22  /***
23   * Creates NodePointers for objects of a certain type.
24   * NodePointerFactories are ordered according to the values returned
25   * by the "getOrder" method and always queried in that order.
26   *
27   * @author Dmitri Plotnikov
28   * @version $Revision: 1.7 $ $Date: 2004/02/29 14:17:45 $
29   */
30  public interface NodePointerFactory {
31  
32      /***
33       * The factory order number determines its position between other factories.
34       */
35      int getOrder();
36  
37      /***
38       * Create a NodePointer for the supplied object.  The node will represent
39       * the "root" object for a path.
40       *
41       * @return  null if this factory does not recognize objects of the supplied
42       * type.
43       */
44      NodePointer createNodePointer(QName name, Object object, Locale locale);
45  
46      /***
47       * Create a NodePointer for the supplied child object.
48       * <p>
49       * @return null if this factory does not recognize objects of the supplied
50       * type.
51       */
52      NodePointer createNodePointer(
53          NodePointer parent,
54          QName name,
55          Object object);
56  }