KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > wsm > model > jsr181 > SOAPBindingInfo


1 package org.apache.beehive.wsm.model.jsr181;
2
3 import javax.jws.soap.SOAPBinding;
4
5 import org.apache.beehive.wsm.model.BeehiveWsSOAPBindingInfo;
6
7 /*
8  * Copyright 2004 The Apache Software Foundation
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License");
11  * you may not use this file except in compliance with the License.
12  * You may obtain a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19  * See the License for the specific language governing permissions and
20  * limitations under the License.
21  *
22  * $Header:$
23  */

24
25 public class SOAPBindingInfo implements java.io.Serializable JavaDoc, BeehiveWsSOAPBindingInfo {
26
27     private static final long serialVersionUID = 1L;
28     
29     SOAPBinding.Style style = SOAPBinding.Style.DOCUMENT;
30     SOAPBinding.Use use = SOAPBinding.Use.LITERAL;
31     SOAPBinding.ParameterStyle parameterStyle = SOAPBinding
32         .ParameterStyle.WRAPPED;
33
34     /**
35      *
36      */

37     public SOAPBindingInfo() {
38         super();
39     }
40
41     public SOAPBindingInfo(SOAPBinding annotation) {
42         initFromAnnotation(annotation);
43     }
44
45     /**
46      * @return Returns the parameterStyle.
47      */

48     public SOAPBinding.ParameterStyle getParameterStyle() {
49         return parameterStyle;
50     }
51
52     /**
53      * @param parameterStyle The parameterStyle to set.
54      */

55     public void setParameterStyle(SOAPBinding.ParameterStyle parameterStyle) {
56         this.parameterStyle = parameterStyle;
57     }
58
59     /**
60      * @return Returns the style.
61      */

62     public SOAPBinding.Style getStyle() {
63         return style;
64     }
65
66     /**
67      * @param style The style to set.
68      */

69     public void setStyle(SOAPBinding.Style style) {
70         this.style = style;
71     }
72
73     /**
74      * @return Returns the use.
75      */

76     public SOAPBinding.Use getUse() {
77         return use;
78     }
79
80     /**
81      * @param use The use to set.
82      */

83     public void setUse(SOAPBinding.Use use) {
84         this.use = use;
85     }
86
87     /**
88      * @param annotation
89      */

90     private void initFromAnnotation(SOAPBinding annotation) {
91         setStyle(annotation.style());
92         setUse(annotation.use());
93         setParameterStyle(annotation.parameterStyle());
94         
95         // set the defaults -- no defaults to set
96
}
97
98     public int hashCode() {
99         return (((getStyle().hashCode() * 31) + getUse().hashCode()) * 31)
100             + getParameterStyle().hashCode();
101     }
102
103     public String JavaDoc toString() {
104         StringBuffer JavaDoc sb = new StringBuffer JavaDoc("SOAPBindingInfo: ");
105         boolean rpc = (getStyle() == SOAPBinding.Style.RPC);
106         boolean encoded = (getUse() == SOAPBinding.Use.ENCODED);
107         sb.append(rpc ? "RPC" : "DOCUMENT");
108         sb.append('/');
109         sb.append(encoded ? "ENCODED" : "LITERAL");
110         if (!rpc && !encoded) {
111             sb.append('-');
112             sb.append((getParameterStyle() == SOAPBinding
113                        .ParameterStyle.BARE)
114                       ? "BARE" : "WRAPPED");
115         }
116         return sb.toString();
117     }
118
119     public boolean equals(Object JavaDoc o) {
120         if (o != null) {
121             if (o instanceof SOAPBindingInfo) {
122                 SOAPBindingInfo sbi = (SOAPBindingInfo)o;
123                 return (getStyle().equals(sbi.getStyle())
124                         && getUse().equals(sbi.getUse())
125                         && getParameterStyle().equals(sbi.getParameterStyle()));
126             }
127         }
128         return false;
129     }
130 }
131
Popular Tags