Source Code Cross Referenced for BISchemaBinding.java in  » 6.0-JDK-Modules-com.sun » tools » com » sun » tools » internal » xjc » reader » xmlschema » bindinfo » 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 » 6.0 JDK Modules com.sun » tools » com.sun.tools.internal.xjc.reader.xmlschema.bindinfo 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006 Sun Microsystems, Inc.  All Rights Reserved.
003:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004:         *
005:         * This code is free software; you can redistribute it and/or modify it
006:         * under the terms of the GNU General Public License version 2 only, as
007:         * published by the Free Software Foundation.  Sun designates this
008:         * particular file as subject to the "Classpath" exception as provided
009:         * by Sun in the LICENSE file that accompanied this code.
010:         *
011:         * This code is distributed in the hope that it will be useful, but WITHOUT
012:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
014:         * version 2 for more details (a copy is included in the LICENSE file that
015:         * accompanied this code).
016:         *
017:         * You should have received a copy of the GNU General Public License version
018:         * 2 along with this work; if not, write to the Free Software Foundation,
019:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020:         *
021:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022:         * CA 95054 USA or visit www.sun.com if you need additional information or
023:         * have any questions.
024:         */
025:
026:        package com.sun.tools.internal.xjc.reader.xmlschema.bindinfo;
027:
028:        import javax.xml.bind.annotation.XmlAttribute;
029:        import javax.xml.bind.annotation.XmlElement;
030:        import javax.xml.bind.annotation.XmlRootElement;
031:        import javax.xml.bind.annotation.XmlType;
032:        import javax.xml.namespace.QName;
033:
034:        import com.sun.tools.internal.xjc.reader.Const;
035:        import com.sun.xml.internal.xsom.XSAttributeDecl;
036:        import com.sun.xml.internal.xsom.XSComponent;
037:        import com.sun.xml.internal.xsom.XSElementDecl;
038:        import com.sun.xml.internal.xsom.XSModelGroup;
039:        import com.sun.xml.internal.xsom.XSModelGroupDecl;
040:        import com.sun.xml.internal.xsom.XSType;
041:
042:        /**
043:         * Schema-wide binding customization.
044:         * 
045:         * @author
046:         *  Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
047:         */
048:        @XmlRootElement(name="schemaBindings")
049:        public final class BISchemaBinding extends AbstractDeclarationImpl {
050:
051:            /**
052:             * Name conversion rules. All defaults to {@link BISchemaBinding#defaultNamingRule}.
053:             */
054:            @XmlType(propOrder={})
055:            private static final class NameRules {
056:                @XmlElement
057:                NamingRule typeName = defaultNamingRule;
058:                @XmlElement
059:                NamingRule elementName = defaultNamingRule;
060:                @XmlElement
061:                NamingRule attributeName = defaultNamingRule;
062:                @XmlElement
063:                NamingRule modelGroupName = defaultNamingRule;
064:                @XmlElement
065:                NamingRule anonymousTypeName = defaultNamingRule;
066:            }
067:
068:            @XmlElement
069:            private NameRules nameXmlTransform = new NameRules();
070:
071:            private static final class PackageInfo {
072:                @XmlAttribute
073:                String name;
074:                @XmlElement
075:                String javadoc;
076:            }
077:
078:            @XmlElement(name="package")
079:            private PackageInfo packageInfo = new PackageInfo();
080:
081:            /**
082:             * Default naming rule, that doesn't change the name.
083:             */
084:            private static final NamingRule defaultNamingRule = new NamingRule(
085:                    "", "");
086:
087:            /**
088:             * Default naming rules of the generated interfaces.
089:             * 
090:             * It simply adds prefix and suffix to the name, but
091:             * the caller shouldn't care how the name mangling is
092:             * done.
093:             */
094:            public static final class NamingRule {
095:                @XmlAttribute
096:                private String prefix = "";
097:                @XmlAttribute
098:                private String suffix = "";
099:
100:                public NamingRule(String _prefix, String _suffix) {
101:                    this .prefix = _prefix;
102:                    this .suffix = _suffix;
103:                }
104:
105:                public NamingRule() {
106:                }
107:
108:                /** Changes the name according to the rule. */
109:                public String mangle(String originalName) {
110:                    return prefix + originalName + suffix;
111:                }
112:            }
113:
114:            /**
115:             * Transforms the default name produced from XML name
116:             * by following the customization.
117:             * 
118:             * This shouldn't be applied to a class name specified
119:             * by a customization.
120:             * 
121:             * @param cmp
122:             *      The schema component from which the default name is derived.
123:             */
124:            public String mangleClassName(String name, XSComponent cmp) {
125:                if (cmp instanceof  XSType)
126:                    return nameXmlTransform.typeName.mangle(name);
127:                if (cmp instanceof  XSElementDecl)
128:                    return nameXmlTransform.elementName.mangle(name);
129:                if (cmp instanceof  XSAttributeDecl)
130:                    return nameXmlTransform.attributeName.mangle(name);
131:                if (cmp instanceof  XSModelGroup
132:                        || cmp instanceof  XSModelGroupDecl)
133:                    return nameXmlTransform.modelGroupName.mangle(name);
134:
135:                // otherwise no modification
136:                return name;
137:            }
138:
139:            public String mangleAnonymousTypeClassName(String name) {
140:                return nameXmlTransform.anonymousTypeName.mangle(name);
141:            }
142:
143:            public String getPackageName() {
144:                return packageInfo.name;
145:            }
146:
147:            public String getJavadoc() {
148:                return packageInfo.javadoc;
149:            }
150:
151:            public QName getName() {
152:                return NAME;
153:            }
154:
155:            public static final QName NAME = new QName(Const.JAXB_NSURI,
156:                    "schemaBinding");
157:        }
w_w__w__.__j___av_a___2___s_._co__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.