Source Code Cross Referenced for Type.java in  » Web-Services-apache-cxf-2.0.1 » databinding » org » apache » cxf » aegis » type » 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 » Web Services apache cxf 2.0.1 » databinding » org.apache.cxf.aegis.type 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Licensed to the Apache Software Foundation (ASF) under one
003:         * or more contributor license agreements. See the NOTICE file
004:         * distributed with this work for additional information
005:         * regarding copyright ownership. The ASF licenses this file
006:         * to you under the Apache License, Version 2.0 (the
007:         * "License"); you may not use this file except in compliance
008:         * with the License. You may obtain a copy of the License at
009:         *
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         *
012:         * Unless required by applicable law or agreed to in writing,
013:         * software distributed under the License is distributed on an
014:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015:         * KIND, either express or implied. See the License for the
016:         * specific language governing permissions and limitations
017:         * under the License.
018:         */package org.apache.cxf.aegis.type;
019:
020:        import java.util.Set;
021:
022:        import javax.xml.namespace.QName;
023:
024:        import org.apache.cxf.aegis.Context;
025:        import org.apache.cxf.aegis.DatabindingException;
026:        import org.apache.cxf.aegis.xml.MessageReader;
027:        import org.apache.cxf.aegis.xml.MessageWriter;
028:        import org.jdom.Element;
029:
030:        /**
031:         * A Type reads and writes XML fragments to create and write objects.
032:         * 
033:         * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
034:         */
035:        public abstract class Type {
036:
037:            protected Class typeClass;
038:
039:            private QName schemaType;
040:
041:            private TypeMapping typeMapping;
042:
043:            private boolean abstrct = true;
044:
045:            private boolean nillable = true;
046:
047:            private boolean writeOuter = true;
048:
049:            public Type() {
050:            }
051:
052:            /**
053:             * Read in the XML fragment and create an object.
054:             * 
055:             * @param reader
056:             * @param context
057:             * @return
058:             * @throws DatabindingException
059:             */
060:            public abstract Object readObject(MessageReader reader,
061:                    Context context) throws DatabindingException;
062:
063:            /**
064:             * Writes the object to the MessageWriter.
065:             * 
066:             * @param object
067:             * @param writer
068:             * @param context
069:             * @throws DatabindingException
070:             */
071:            public abstract void writeObject(Object object,
072:                    MessageWriter writer, Context context)
073:                    throws DatabindingException;
074:
075:            public void writeSchema(Element root) {
076:            }
077:
078:            /**
079:             * @return Returns the typeMapping.
080:             */
081:            public TypeMapping getTypeMapping() {
082:                return typeMapping;
083:            }
084:
085:            /**
086:             * @param typeMapping The typeMapping to set.
087:             */
088:            public void setTypeMapping(TypeMapping typeMapping) {
089:                this .typeMapping = typeMapping;
090:            }
091:
092:            /**
093:             * @return Returns the typeClass.
094:             */
095:            public Class getTypeClass() {
096:                return typeClass;
097:            }
098:
099:            /**
100:             * @param typeClass The typeClass to set.
101:             */
102:            public void setTypeClass(Class typeClass) {
103:                this .typeClass = typeClass;
104:
105:                if (typeClass.isPrimitive()) {
106:                    setNillable(false);
107:                }
108:            }
109:
110:            /**
111:             * @return True if a complex type schema must be written.
112:             */
113:            public boolean isComplex() {
114:                return false;
115:            }
116:
117:            public boolean isAbstract() {
118:                return abstrct;
119:            }
120:
121:            public void setAbstract(boolean ab) {
122:                this .abstrct = ab;
123:            }
124:
125:            public boolean isNillable() {
126:                return nillable;
127:            }
128:
129:            public void setNillable(boolean nillable) {
130:                this .nillable = nillable;
131:            }
132:
133:            /**
134:             * Return a set of Type dependencies. Returns null if this type has no
135:             * dependencies.
136:             * 
137:             * @return Set of <code>Type</code> dependencies
138:             */
139:            public Set<Type> getDependencies() {
140:                return null;
141:            }
142:
143:            /**
144:             * @see java.lang.Object#equals(java.lang.Object)
145:             */
146:            @Override
147:            public boolean equals(Object obj) {
148:                if (obj == this ) {
149:                    return true;
150:                }
151:
152:                if (obj instanceof  Type) {
153:                    Type type = (Type) obj;
154:
155:                    if (type.getSchemaType().equals(getSchemaType())
156:                            && type.getTypeClass().equals(getTypeClass())) {
157:                        return true;
158:                    }
159:                }
160:
161:                return false;
162:            }
163:
164:            @Override
165:            public int hashCode() {
166:                int hashcode = 0;
167:
168:                if (getTypeClass() != null) {
169:                    hashcode ^= getTypeClass().hashCode();
170:                }
171:
172:                if (getSchemaType() != null) {
173:                    hashcode ^= getSchemaType().hashCode();
174:                }
175:
176:                return hashcode;
177:            }
178:
179:            /**
180:             * @return Get the schema type.
181:             */
182:            public QName getSchemaType() {
183:                return schemaType;
184:            }
185:
186:            /**
187:             * @param name The qName to set.
188:             */
189:            public void setSchemaType(QName name) {
190:                schemaType = name;
191:            }
192:
193:            public boolean isWriteOuter() {
194:                return writeOuter;
195:            }
196:
197:            public void setWriteOuter(boolean writeOuter) {
198:                this .writeOuter = writeOuter;
199:            }
200:
201:            @Override
202:            public String toString() {
203:                StringBuffer sb = new StringBuffer(getClass().getName());
204:                sb.append("[class=");
205:                Class c = getTypeClass();
206:                sb.append((c == null) ? "<null>" : c.getName());
207:                sb.append(",\nQName=");
208:                QName q = getSchemaType();
209:                sb.append((q == null) ? "<null>" : q.toString());
210:                sb.append("]");
211:                return sb.toString();
212:            }
213:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.