    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
    018package org.apache.commons.jxpath.ri.model;
    019
    020import java.util.Locale;
    021
    022import org.apache.commons.jxpath.ri.QName;
    023
    024/**
    025 * Creates NodePointers for objects of a certain type. NodePointerFactories are ordered according to the values returned by the "getOrder" method and always
    026 * queried in that order.
    027 */
    028public interface NodePointerFactory {
    029
    030    /**
    031     * Create a NodePointer for the supplied child object.
    032     *
    033     * @param parent parent node
    034     * @param qName  node name
    035     * @param object child object
    036     * @return null if this factory does not recognize objects of the supplied type.
    037     */
    038    NodePointer createNodePointer(NodePointer parent, QName qName, Object object);
    039
    040    /**
    041     * Create a NodePointer for the supplied object. The node will represent the "root" object for a path.
    042     *
    043     * @param qName  node name
    044     * @param object child object
    045     * @param locale Locale
    046     * @return null if this factory does not recognize objects of the supplied type.
    047     */
    048    NodePointer createNodePointer(QName qName, Object object, Locale locale);
    049
    050    /**
    051     * The factory order number determines its position between other factories.
    052     *
    053     * @return int order
    054     */
    055    int getOrder();
    056}