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 */ 017package org.apache.commons.jxpath.ri.compiler; 018 019import org.apache.commons.jxpath.ri.QName; 020 021/** 022 * @author Dmitri Plotnikov 023 * @version $Revision: 652845 $ $Date: 2008-05-02 19:46:46 +0200 (Fr, 02 Mai 2008) $ 024 */ 025public class NodeNameTest extends NodeTest { 026 private QName qname; 027 private String namespaceURI; 028 029 /** 030 * Create a new NodeNameTest. 031 * @param qname name to match 032 */ 033 public NodeNameTest(QName qname) { 034 this.qname = qname; 035 } 036 037 /** 038 * Create a new NodeNameTest. 039 * @param qname name to match 040 * @param namespaceURI uri to match 041 */ 042 public NodeNameTest(QName qname, String namespaceURI) { 043 this.qname = qname; 044 this.namespaceURI = namespaceURI; 045 } 046 047 /** 048 * Get the node name. 049 * @return QName 050 */ 051 public QName getNodeName() { 052 return qname; 053 } 054 055 /** 056 * Get the ns URI. 057 * @return String 058 */ 059 public String getNamespaceURI() { 060 return namespaceURI; 061 } 062 063 /** 064 * Learn whether this is a wildcard test. 065 * @return <code>true</code> if the node name is "*". 066 */ 067 public boolean isWildcard() { 068 return qname.getName().equals("*"); 069 } 070 071 public String toString() { 072 return qname.toString(); 073 } 074}