Source Code Cross Referenced for ValueCustom.java in  » XML » jibx-1.1.5 » org » jibx » ws » wsdl » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » XML » jibx 1.1.5 » org.jibx.ws.wsdl 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:        Copyright (c) 2007, Dennis M. Sosnoski
003:        All rights reserved.
004:
005:        Redistribution and use in source and binary forms, with or without modification,
006:        are permitted provided that the following conditions are met:
007:
008:         * Redistributions of source code must retain the above copyright notice, this
009:           list of conditions and the following disclaimer.
010:         * Redistributions in binary form must reproduce the above copyright notice,
011:           this list of conditions and the following disclaimer in the documentation
012:           and/or other materials provided with the distribution.
013:         * Neither the name of JiBX nor the names of its contributors may be used
014:           to endorse or promote products derived from this software without specific
015:           prior written permission.
016:
017:        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
018:        ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
019:        WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
020:        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
021:        ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
022:        (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
023:        LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
024:        ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
025:        (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
026:        SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027:         */
028:
029:        package org.jibx.ws.wsdl;
030:
031:        import java.util.Collection;
032:        import java.util.List;
033:
034:        import org.jibx.binding.classes.ClassItem;
035:        import org.jibx.binding.generator.ClassCustom;
036:        import org.jibx.binding.generator.CustomBase;
037:        import org.jibx.runtime.IUnmarshallingContext;
038:        import org.jibx.runtime.JiBXException;
039:        import org.jibx.runtime.impl.UnmarshallingContext;
040:
041:        /**
042:         * Method parameter or return value customization information.
043:         */
044:        public class ValueCustom extends CustomBase {
045:            // value customization information
046:            private boolean m_primitive; // internal use, not included in binding
047:            private String m_boundType; // internal use, not included in binding
048:            private String m_valueName;
049:            private String m_elementName;
050:            private String m_type;
051:            private String m_createType;
052:            private String m_factoryMethod;
053:            private Boolean m_required;
054:            private List m_documentation;
055:
056:            /**
057:             * Constructor.
058:             * 
059:             * @param parent
060:             * @param name
061:             */
062:            protected ValueCustom(NestingBase parent, String name) {
063:                super (parent);
064:                m_valueName = name;
065:            }
066:
067:            /**
068:             * Get value name.
069:             *
070:             * @return name
071:             */
072:            public String getValueName() {
073:                return m_valueName;
074:            }
075:
076:            /**
077:             * Get XML element name.
078:             *
079:             * @return name
080:             */
081:            public String getElementName() {
082:                return m_elementName;
083:            }
084:
085:            /**
086:             * Set XML element name.
087:             *
088:             * @param name
089:             */
090:            public void setElementName(String name) {
091:                m_elementName = name;
092:            }
093:
094:            /**
095:             * Get value type. This method should only be used after the {@link
096:             * #complete(String, List, Boolean)} method is called.
097:             *
098:             * @return value type
099:             */
100:            public String getType() {
101:                return m_type;
102:            }
103:
104:            /**
105:             * Get item type for parameterized list collection. This base class
106:             * implementation always returns <code>null</code>.
107:             *
108:             * @return <code>null</code>
109:             */
110:            public String getItemType() {
111:                return null;
112:            }
113:
114:            /**
115:             * Get value type to be bound. This is the same as the plain value type
116:             * for a simple (non-collection); for an array value, it's just the array
117:             * item type; and for a non-array collection it takes the same form as a
118:             * generic type declaration, with the actual item type enclosed in a
119:             * less-than/greater-than sign pair following the base type.
120:             *
121:             * @return parmaterized type
122:             */
123:            public String getBoundType() {
124:                return m_boundType;
125:            }
126:
127:            /**
128:             * Get name for elements representing items in collection. This base class
129:             * implementation always returns <code>null</code>.
130:             *
131:             * @return <code>null</code>
132:             */
133:            public String getItemElementName() {
134:                return null;
135:            }
136:
137:            /**
138:             * Get member create type.
139:             *
140:             * @return type used for creating new instance (<code>null</code> if none)
141:             */
142:            public String getCreateType() {
143:                return m_createType;
144:            }
145:
146:            /**
147:             * Get factory method.
148:             *
149:             * @return method used for creating new instance (<code>null</code> if none)
150:             */
151:            public String getFactoryMethod() {
152:                return m_factoryMethod;
153:            }
154:
155:            /**
156:             * Check if value is required.
157:             *
158:             * @return <code>true</code> if required, <code>false</code> if not
159:             */
160:            public boolean isRequired() {
161:                if (m_required == null) {
162:                    if (m_primitive) {
163:                        return getParent().isPrimitiveRequired(m_type);
164:                    } else {
165:                        return getParent().isObjectRequired(m_type);
166:                    }
167:                } else {
168:                    return m_required.booleanValue();
169:                }
170:            }
171:
172:            /**
173:             * Get value documentation node list. This method should only be used after
174:             * the {@link #complete(String, List, Boolean)} method is called.
175:             *
176:             * @return list of documentation nodes (<code>null</code> if none)
177:             */
178:            public List getDocumentation() {
179:                return m_documentation;
180:            }
181:
182:            /**
183:             * Complete customization information based on supplied type. If the type
184:             * information has not previously been set, this will set it. It will also
185:             * derive the appropriate XML name, if not previously set.
186:             *
187:             * @param type (<code>null</code> if none available)
188:             * @param docs default documentation text (<code>null</code> if none)
189:             * @param req required member flag (<code>null</code> if unknown)
190:             */
191:            /*package*/void complete(String type, List docs, Boolean req) {
192:                if (m_type == null) {
193:                    if (type == null) {
194:                        m_type = "java.lang.Object";
195:                    } else {
196:                        m_type = type;
197:                    }
198:                }
199:                m_primitive = ClassItem.isPrimitive(m_type);
200:                // TODO: check consistency of setting
201:                if (m_required == null) {
202:                    m_required = req;
203:                }
204:                if (m_documentation == null) {
205:                    m_documentation = docs;
206:                }
207:                String itype = getItemType();
208:                if (itype == null) {
209:                    if (type.endsWith("[]")) {
210:                        m_boundType = type.substring(0, type.length() - 2);
211:                    } else {
212:                        m_boundType = type;
213:                    }
214:                } else {
215:                    m_boundType = type + '<' + itype + '>';
216:                }
217:                if (!m_primitive && m_createType == null
218:                        && m_factoryMethod == null) {
219:                    ClassCustom cust = getGlobal().getClassCustomization(type);
220:                    if (cust != null) {
221:                        m_createType = cust.getCreateType();
222:                        m_factoryMethod = cust.getFactoryMethod();
223:                    }
224:                }
225:            }
226:
227:            /**
228:             * Parameter value unmarshalling factory. This gets the containing element
229:             * and the name so that the standard constructor can be used.
230:             *
231:             * @param ictx
232:             * @return created instance
233:             * @throws JiBXException
234:             */
235:            private static ValueCustom parameterFactory(
236:                    IUnmarshallingContext ictx) throws JiBXException {
237:                UnmarshallingContext uctx = (UnmarshallingContext) ictx;
238:                Object parent = uctx.getStackTop();
239:                int depth = 0;
240:                if (parent instanceof  Collection) {
241:                    parent = uctx.getStackObject(++depth);
242:                }
243:                return new ValueCustom((OperationCustom) parent, uctx
244:                        .attributeText(null, "name"));
245:            }
246:
247:            /**
248:             * Return value unmarshalling factory. This gets the containing element
249:             * so that the standard constructor can be used.
250:             *
251:             * @param ictx
252:             * @return created instance
253:             */
254:            private static ValueCustom returnFactory(IUnmarshallingContext ictx) {
255:                Object parent = ictx.getStackTop();
256:                int depth = 0;
257:                if (parent instanceof  Collection) {
258:                    parent = ictx.getStackObject(++depth);
259:                }
260:                return new ValueCustom((OperationCustom) parent, "return");
261:            }
262:
263:            /**
264:             * Parameter value unmarshalling factory. This gets the containing element
265:             * and the name so that the standard constructor can be used.
266:             *
267:             * @param ictx
268:             * @return created instance
269:             * @throws JiBXException
270:             */
271:            private static CollectionValueCustom collectionParameterFactory(
272:                    IUnmarshallingContext ictx) throws JiBXException {
273:                UnmarshallingContext uctx = (UnmarshallingContext) ictx;
274:                Object parent = uctx.getStackTop();
275:                int depth = 0;
276:                if (parent instanceof  Collection) {
277:                    parent = uctx.getStackObject(++depth);
278:                }
279:                return new CollectionValueCustom((OperationCustom) parent, uctx
280:                        .attributeText(null, "name"));
281:            }
282:
283:            /**
284:             * Return value unmarshalling factory. This gets the containing element
285:             * so that the standard constructor can be used.
286:             *
287:             * @param ictx
288:             * @return created instance
289:             */
290:            private static CollectionValueCustom collectionReturnFactory(
291:                    IUnmarshallingContext ictx) {
292:                Object parent = ictx.getStackTop();
293:                int depth = 0;
294:                if (parent instanceof  Collection) {
295:                    parent = ictx.getStackObject(++depth);
296:                }
297:                return new CollectionValueCustom((OperationCustom) parent,
298:                        "return");
299:            }
300:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.