KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > celtix > tools > common > model > JavaInterface


1 package org.objectweb.celtix.tools.common.model;
2
3 import java.util.*;
4 import javax.jws.soap.SOAPBinding;
5 import org.w3c.dom.Element JavaDoc;
6 import org.objectweb.celtix.tools.common.ToolException;
7 import org.objectweb.celtix.tools.extensions.jaxws.JAXWSBinding;
8
9 public class JavaInterface {
10
11     private String JavaDoc name;
12     private String JavaDoc packageName;
13     private String JavaDoc namespace;
14     private String JavaDoc location;
15     private JavaModel model;
16     private SOAPBinding.Style soapStyle;
17     private SOAPBinding.Use soapUse;
18     private SOAPBinding.ParameterStyle soapParameterStyle;
19     
20     private final List<JavaMethod> methods = new ArrayList<JavaMethod>();
21     private final List<String JavaDoc> annotations = new ArrayList<String JavaDoc>();
22     private final Set<String JavaDoc> imports = new TreeSet<String JavaDoc>();
23
24     private JAXWSBinding jaxwsBinding = new JAXWSBinding();
25     private JAXWSBinding bindingExt = new JAXWSBinding();
26     
27     private String JavaDoc webserviceName;
28     private Element JavaDoc handlerChains;
29     
30     public JavaInterface() {
31     }
32     
33     public JavaInterface(JavaModel m) {
34         this.model = m;
35     }
36
37     public void setWebServiceName(String JavaDoc wsn) {
38         this.webserviceName = wsn;
39     }
40
41     public String JavaDoc getWebServiceName() {
42         return this.webserviceName;
43     }
44
45     public void setSOAPStyle(SOAPBinding.Style s) {
46         this.soapStyle = s;
47     }
48
49     public SOAPBinding.Style getSOAPStyle() {
50         return this.soapStyle;
51     }
52
53     public void setSOAPUse(SOAPBinding.Use u) {
54         this.soapUse = u;
55     }
56
57     public SOAPBinding.Use getSOAPUse() {
58         return this.soapUse;
59     }
60
61     public void setSOAPParameterStyle(SOAPBinding.ParameterStyle p) {
62         this.soapParameterStyle = p;
63     }
64     
65     public SOAPBinding.ParameterStyle getSOAPParameterStyle() {
66         return this.soapParameterStyle;
67     }
68     
69     public JavaModel getJavaModel() {
70         return this.model;
71     }
72     
73     public void setName(String JavaDoc n) {
74         this.name = n;
75     }
76     
77     public String JavaDoc getName() {
78         return name;
79     }
80
81     public void setLocation(String JavaDoc l) {
82         this.location = l;
83     }
84
85     public String JavaDoc getLocation() {
86         return this.location;
87     }
88
89     public List<JavaMethod> getMethods() {
90         return methods;
91     }
92
93     public boolean hasMethod(JavaMethod method) {
94         if (method != null) {
95             String JavaDoc signature = method.getSignature();
96             for (int i = 0; i < methods.size(); i++) {
97                 if (signature.equals(methods.get(i).getSignature())) {
98                     return true;
99                 }
100             }
101         }
102         return false;
103     }
104
105     public int indexOf(JavaMethod method) {
106         if (method != null) {
107             String JavaDoc signature = method.getSignature();
108             for (int i = 0; i < methods.size(); i++) {
109                 if (signature.equals(methods.get(i).getSignature())) {
110                     return i;
111                 }
112             }
113         }
114         return -1;
115     }
116
117     public int removeMethod(JavaMethod method) {
118         int index = indexOf(method);
119         if (index > -1) {
120             methods.remove(index);
121         }
122         return index;
123     }
124
125     public void replaceMethod(JavaMethod method) {
126         int index = removeMethod(method);
127         methods.add(index, method);
128     }
129
130     public void addMethod(JavaMethod method) throws ToolException {
131         if (hasMethod(method)) {
132             replaceMethod(method);
133         } else {
134             methods.add(method);
135         }
136     }
137
138     public String JavaDoc getPackageName() {
139         return this.packageName;
140     }
141
142     public void setPackageName(String JavaDoc pn) {
143         this.packageName = pn;
144     }
145
146     public String JavaDoc getNamespace() {
147         return this.namespace;
148     }
149
150     public void setNamespace(String JavaDoc ns) {
151         this.namespace = ns;
152     }
153
154     public void addAnnotation(String JavaDoc annotation) {
155         this.annotations.add(annotation);
156     }
157
158     public List getAnnotations() {
159         return this.annotations;
160     }
161
162     public JAXWSBinding getJAXWSBinding() {
163         return this.jaxwsBinding;
164     }
165     
166     public void setJAXWSBinding(JAXWSBinding binding) {
167         if (binding != null) {
168             this.jaxwsBinding = binding;
169         }
170     }
171
172     public void addImport(String JavaDoc i) {
173         imports.add(i);
174     }
175
176     public Iterator<String JavaDoc> getImports() {
177         return imports.iterator();
178     }
179
180     public Element JavaDoc getHandlerChains() {
181         return this.handlerChains;
182     }
183
184     public void setHandlerChains(Element JavaDoc elem) {
185         this.handlerChains = elem;
186     }
187
188     public JAXWSBinding getBindingExt() {
189         return bindingExt;
190     }
191
192     public void setBindingExt(JAXWSBinding pBindingExt) {
193         this.bindingExt = pBindingExt;
194     }
195 }
196
Popular Tags