001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.commons.jxpath.ri.model;
018
019 import java.util.Locale;
020
021 import org.apache.commons.jxpath.ri.QName;
022
023 /**
024 * Creates NodePointers for objects of a certain type.
025 * NodePointerFactories are ordered according to the values returned
026 * by the "getOrder" method and always queried in that order.
027 *
028 * @author Dmitri Plotnikov
029 * @version $Revision: 652845 $ $Date: 2008-05-02 12:46:46 -0500 (Fri, 02 May 2008) $
030 */
031 public interface NodePointerFactory {
032
033 /**
034 * The factory order number determines its position between other factories.
035 * @return int order
036 */
037 int getOrder();
038
039 /**
040 * Create a NodePointer for the supplied object. The node will represent
041 * the "root" object for a path.
042 *
043 * @param name String node name
044 * @param object child object
045 * @param locale Locale
046 * @return null if this factory does not recognize objects of the supplied
047 * type.
048 */
049 NodePointer createNodePointer(QName name, Object object, Locale locale);
050
051 /**
052 * Create a NodePointer for the supplied child object.
053 *
054 * @param parent parent node
055 * @param name String node name
056 * @param object child object
057 * @return null if this factory does not recognize objects of the supplied
058 * type.
059 */
060 NodePointer createNodePointer(
061 NodePointer parent,
062 QName name,
063 Object object);
064 }