
org.apache.ws.jaxme.WildcardAttribute Maven / Gradle / Ivy
The newest version!
/*
* Copyright 2004 The Apache Software Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ws.jaxme;
import javax.xml.namespace.QName;
/** Wildcard attributes (as specified by xs:anyAttribute
)
* are stored in a set, the set elements being instances of
* WildcardAttribute
.
* @author Jochen Wiedmann
*/
public class WildcardAttribute {
private final QName name;
private final String value;
/** Creates a new instance of WildcardAttribute
* with the given name and value.
* @throws NullPointerException Either of the arguments is null.
*/
public WildcardAttribute(QName pName, String pValue) {
if (pName == null) {
throw new NullPointerException("A wildcard attributes name must not be null.");
}
if (pValue == null) {
throw new NullPointerException("A wildcard attributes value must not be null.");
}
name = pName;
value = pValue;
}
/** Returns the attributes name.
*/
public QName getName() {
return name;
}
/** Returns the attributes value.
*/
public String getValue() {
return value;
}
public String toString() {
return name + "=" + value;
}
/** Returns getName().hashCode()
.
*/
public int hashCode() {
return name.hashCode();
}
/** Returns true, if the object pOther
is an instance of
* WildcardAttribute
and pOther.getName().equals(getName())
.
*/
public boolean equals(Object pOther) {
return pOther != null && pOther instanceof WildcardAttribute &&
((WildcardAttribute) pOther).name.equals(name);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy