< prev index next >
src/java.xml.ws/share/classes/com/sun/xml/internal/messaging/saaj/soap/impl/ElementImpl.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -160,12 +160,12 @@
org.w3c.dom.Node currentAncestor = this;
while (currentAncestor != null &&
!(currentAncestor instanceof Document)) {
if (currentAncestor instanceof ElementImpl) {
- QName name = ((ElementImpl) currentAncestor).getElementQName();
/*
+ QName name = ((ElementImpl) currentAncestor).getElementQName();
if (prefix.equals(name.getPrefix())) {
String uri = name.getNamespaceURI();
if ("".equals(uri)) {
return null;
}
@@ -337,11 +337,11 @@
// if body is not empty throw an exception
if (!elementURI.equals(this.getElementName().getURI())) {
log.severe("SAAJ0158.impl.version.mismatch.fault");
throw new SOAPExceptionImpl("SOAP Version mismatch encountered when trying to add SOAPFault to SOAPBody");
}
- Iterator it = this.getChildElements();
+ Iterator<Node> it = this.getChildElements();
if (it.hasNext()) {
log.severe("SAAJ0156.impl.adding.fault.error");
throw new SOAPExceptionImpl("Cannot add SOAPFault as a child of a non-Empty SOAPBody");
}
}
@@ -448,11 +448,11 @@
}
return null;
}
protected SOAPElement findAndConvertChildElement(NameImpl name) {
- Iterator eachChild = getChildElementNodes();
+ Iterator<Node> eachChild = getChildElementNodes();
while (eachChild.hasNext()) {
SOAPElement child = (SOAPElement) eachChild.next();
if (child.getElementName().equals(name)) {
return child;
}
@@ -558,25 +558,25 @@
qname.getPrefix(),
getQualifiedName(qname));
}
public Iterator getAllAttributes() {
- Iterator i = getAllAttributesFrom(this);
- ArrayList list = new ArrayList();
+ Iterator<Name> i = getAllAttributesFrom(this);
+ ArrayList<Name> list = new ArrayList<Name>();
while (i.hasNext()) {
- Name name = (Name) i.next();
+ Name name = i.next();
if (!"xmlns".equalsIgnoreCase(name.getPrefix()))
list.add(name);
}
return list.iterator();
}
public Iterator getAllAttributesAsQNames() {
- Iterator i = getAllAttributesFrom(this);
- ArrayList list = new ArrayList();
+ Iterator<Name> i = getAllAttributesFrom(this);
+ ArrayList<QName> list = new ArrayList<QName>();
while (i.hasNext()) {
- Name name = (Name) i.next();
+ Name name = i.next();
if (!"xmlns".equalsIgnoreCase(name.getPrefix())) {
list.add(NameImpl.convertToQName(name));
}
}
return list.iterator();
@@ -589,12 +589,12 @@
public Iterator getVisibleNamespacePrefixes() {
return doGetNamespacePrefixes(true);
}
- protected Iterator doGetNamespacePrefixes(final boolean deep) {
- return new Iterator() {
+ protected Iterator<String> doGetNamespacePrefixes(final boolean deep) {
+ return new Iterator<String>() {
String next = null;
String last = null;
NamespaceContextIterator eachNamespace =
getNamespaceContextNodes(deep);
@@ -611,11 +611,11 @@
public boolean hasNext() {
findNext();
return next != null;
}
- public Object next() {
+ public String next() {
findNext();
if (next == null) {
throw new NoSuchElementException();
}
@@ -674,11 +674,11 @@
// ignore
}
return true;
}
- public Iterator getChildElements() {
+ public Iterator<Node> getChildElements() {
return getChildElementsFrom(this);
}
protected SOAPElement convertToSoapElement(Element element) {
if (element instanceof SOAPElement) {
@@ -692,19 +692,19 @@
protected static SOAPElement replaceElementWithSOAPElement(
Element element,
ElementImpl copy) {
- Iterator eachAttribute = getAllAttributesFrom(element);
+ Iterator<Name> eachAttribute = getAllAttributesFrom(element);
while (eachAttribute.hasNext()) {
- Name name = (Name) eachAttribute.next();
+ Name name = eachAttribute.next();
copy.addAttributeBare(name, getAttributeValueFrom(element, name));
}
- Iterator eachChild = getChildElementsFrom(element);
+ Iterator<Node> eachChild = getChildElementsFrom(element);
while (eachChild.hasNext()) {
- Node nextChild = (Node) eachChild.next();
+ Node nextChild = eachChild.next();
copy.insertBefore(nextChild, null);
}
Node parent = element.getParentNode();
if (parent != null) {
@@ -712,30 +712,30 @@
} // XXX else throw an exception?
return copy;
}
- protected Iterator getChildElementNodes() {
- return new Iterator() {
- Iterator eachNode = getChildElements();
+ protected Iterator<Node> getChildElementNodes() {
+ return new Iterator<Node>() {
+ Iterator<Node> eachNode = getChildElements();
Node next = null;
Node last = null;
public boolean hasNext() {
if (next == null) {
while (eachNode.hasNext()) {
- Node node = (Node) eachNode.next();
+ Node node = eachNode.next();
if (node instanceof SOAPElement) {
next = node;
break;
}
}
}
return next != null;
}
- public Object next() {
+ public Node next() {
if (hasNext()) {
last = next;
next = null;
return last;
}
@@ -759,20 +759,20 @@
public Iterator getChildElements(final QName qname) {
return getChildElements(qname.getNamespaceURI(), qname.getLocalPart());
}
- private Iterator getChildElements(final String nameUri, final String nameLocal) {
- return new Iterator() {
- Iterator eachElement = getChildElementNodes();
+ private Iterator<Node> getChildElements(final String nameUri, final String nameLocal) {
+ return new Iterator<Node>() {
+ Iterator<Node> eachElement = getChildElementNodes();
Node next = null;
Node last = null;
public boolean hasNext() {
if (next == null) {
while (eachElement.hasNext()) {
- Node element = (Node) eachElement.next();
+ Node element = eachElement.next();
String elementUri = element.getNamespaceURI();
elementUri = elementUri == null ? "" : elementUri;
String elementName = element.getLocalName();
if (elementUri.equals(nameUri)
&& elementName.equals(nameLocal)) {
@@ -782,11 +782,11 @@
}
}
return next != null;
}
- public Object next() {
+ public Node next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
last = next;
next = null;
@@ -892,11 +892,11 @@
return null;
}
protected javax.xml.soap.Node getValueNode() {
- Iterator i = getChildElements();
+ Iterator<Node> i = getChildElements();
while (i.hasNext()) {
javax.xml.soap.Node n = (javax.xml.soap.Node) i.next();
if (n.getNodeType() == org.w3c.dom.Node.TEXT_NODE ||
n.getNodeType() == org.w3c.dom.Node.CDATA_SECTION_NODE) {
// TODO: Hack to fix text node split into multiple lines.
@@ -1052,23 +1052,23 @@
}
}
return null;
}
- protected static Iterator getAllAttributesFrom(final Element element) {
+ protected static Iterator<Name> getAllAttributesFrom(final Element element) {
final NamedNodeMap attributes = element.getAttributes();
- return new Iterator() {
+ return new Iterator<Name>() {
int attributesLength = attributes.getLength();
int attributeIndex = 0;
String currentName;
public boolean hasNext() {
return attributeIndex < attributesLength;
}
- public Object next() {
+ public Name next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
Node current = attributes.item(attributeIndex++);
currentName = current.getNodeName();
@@ -1131,12 +1131,12 @@
attribute = element.getAttributeNode(qualifiedName);
return attribute == null ? null : attribute.getValue();
}
- protected static Iterator getChildElementsFrom(final Element element) {
- return new Iterator() {
+ protected static Iterator<Node> getChildElementsFrom(final Element element) {
+ return new Iterator<Node>() {
Node next = element.getFirstChild();
Node nextNext = null;
Node last = null;
public boolean hasNext() {
@@ -1148,11 +1148,11 @@
}
return next != null;
}
- public Object next() {
+ public Node next() {
if (hasNext()) {
last = next;
next = null;
if ((element instanceof ElementImpl)
< prev index next >