1 5 6 package javax.xml.ws.wsaddressing; 7 8 9 import org.w3c.dom.Element ; 10 11 import java.util.ArrayList ; 12 import java.util.List ; 13 import javax.xml.namespace.QName ; 14 import javax.xml.ws.WebServiceException; 15 import javax.xml.ws.spi.Provider; 16 17 18 45 public final class W3CEndpointReferenceBuilder { 46 49 public W3CEndpointReferenceBuilder() { 50 referenceParameters = new ArrayList <Element >(); 51 metadata = new ArrayList <Element >(); 52 } 53 54 70 public W3CEndpointReferenceBuilder address(String address) { 71 this.address = address; 72 return this; 73 } 74 75 89 public W3CEndpointReferenceBuilder serviceName(QName serviceName) { 90 this.serviceName = serviceName; 91 return this; 92 } 93 94 113 public W3CEndpointReferenceBuilder endpointName(QName endpointName) { 114 if (serviceName == null) { 115 throw new IllegalStateException ("The W3CEndpointReferenceBuilder's serviceName must be set before setting the endpointName: "+endpointName); 116 } 117 118 this.endpointName = endpointName; 119 return this; 120 } 121 122 133 public W3CEndpointReferenceBuilder wsdlDocumentLocation(String wsdlDocumentLocation) { 134 this.wsdlDocumentLocation = wsdlDocumentLocation; 135 return this; 136 } 137 138 153 public W3CEndpointReferenceBuilder referenceParameter(Element referenceParameter) { 154 if (referenceParameter == null) 155 throw new java.lang.IllegalArgumentException ("The referenceParameter cannot be null."); 156 referenceParameters.add(referenceParameter); 157 return this; 158 } 159 160 175 public W3CEndpointReferenceBuilder metadata(Element metadataElement) { 176 if (metadataElement == null) 177 throw new java.lang.IllegalArgumentException ("The metadataElement cannot be null."); 178 metadata.add(metadataElement); 179 return this; 180 } 181 182 227 public W3CEndpointReference build() { 228 return Provider.provider().createW3CEndpointReference(address, 229 serviceName, endpointName, metadata, wsdlDocumentLocation, 230 referenceParameters); 231 } 232 233 private String address; 234 private List <Element > referenceParameters; 235 private List <Element > metadata; 236 private QName serviceName; 237 private QName endpointName; 238 private String wsdlDocumentLocation; 239 } 240 | Popular Tags |