com.sun.tools.ws.processor.model.Service Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jaxws-tools Show documentation
Show all versions of jaxws-tools Show documentation
Open source Reference Implementation of JSR-224: Java API for XML Web Services
The newest version!
/*
* Copyright (c) 1997, 2023 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.sun.tools.ws.processor.model;
import com.sun.tools.ws.processor.model.java.JavaInterface;
import com.sun.tools.ws.wsdl.framework.Entity;
import javax.xml.namespace.QName;
import java.util.*;
/**
*
* @author WS Development Team
*/
public class Service extends ModelObject {
public Service(Entity entity) {
super(entity);
}
public Service(QName name, JavaInterface javaInterface, Entity entity) {
super(entity);
this.name = name;
this.javaInterface = javaInterface;
}
public QName getName() {
return name;
}
public void setName(QName n) {
name = n;
}
public void addPort(Port port) {
if (portsByName.containsKey(port.getName())) {
throw new ModelException("model.uniqueness");
}
ports.add(port);
portsByName.put(port.getName(), port);
}
public Port getPortByName(QName n) {
if (portsByName.size() != ports.size()) {
initializePortsByName();
}
return portsByName.get(n);
}
/* serialization */
public List getPorts() {
return ports;
}
/* serialization */
public void setPorts(List m) {
ports = m;
// initializePortsByName();
}
private void initializePortsByName() {
portsByName = new HashMap<>();
if (ports != null) {
for (Port port : ports) {
if (port.getName() != null &&
portsByName.containsKey(port.getName())) {
throw new ModelException("model.uniqueness");
}
portsByName.put(port.getName(), port);
}
}
}
public JavaInterface getJavaIntf() {
return getJavaInterface();
}
public JavaInterface getJavaInterface() {
return javaInterface;
}
public void setJavaInterface(JavaInterface i) {
javaInterface = i;
}
@Override
public void accept(ModelVisitor visitor) throws Exception {
visitor.visit(this);
}
private QName name;
private List ports = new ArrayList<>();
private Map portsByName = new HashMap<>();
private JavaInterface javaInterface;
}