Source Code Cross Referenced for NodeType.java in  » Database-ORM » castor » org » exolab » castor » xml » 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 » Database ORM » castor » org.exolab.castor.xml 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Redistribution and use of this software and associated documentation
003:         * ("Software"), with or without modification, are permitted provided
004:         * that the following conditions are met:
005:         *
006:         * 1. Redistributions of source code must retain copyright
007:         *    statements and notices.  Redistributions must also contain a
008:         *    copy of this document.
009:         *
010:         * 2. Redistributions in binary form must reproduce the
011:         *    above copyright notice, this list of conditions and the
012:         *    following disclaimer in the documentation and/or other
013:         *    materials provided with the distribution.
014:         *
015:         * 3. The name "Exolab" must not be used to endorse or promote
016:         *    products derived from this Software without prior written
017:         *    permission of Intalio, Inc.  For written permission,
018:         *    please contact info@exolab.org.
019:         *
020:         * 4. Products derived from this Software may not be called "Exolab"
021:         *    nor may "Exolab" appear in their names without prior written
022:         *    permission of Intalio, Inc. Exolab is a registered
023:         *    trademark of Intalio, Inc.
024:         *
025:         * 5. Due credit should be given to the Exolab Project
026:         *    (http://www.exolab.org/).
027:         *
028:         * THIS SOFTWARE IS PROVIDED BY INTALIO, INC. AND CONTRIBUTORS
029:         * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
030:         * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
031:         * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
032:         * INTALIO, INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
033:         * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
034:         * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
035:         * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
036:         * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
037:         * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
038:         * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
039:         * OF THE POSSIBILITY OF SUCH DAMAGE.
040:         *
041:         * Copyright 1999-2002 (C) Intalio, Inc. All Rights Reserved.
042:         *
043:         * $Id: NodeType.java 6761 2007-01-18 05:57:59Z ekuns $
044:         */
045:        package org.exolab.castor.xml;
046:
047:        /**
048:         * The possible node types for an XML field. A field can be represented as an
049:         * attribute, an element or text content. The default is attribute.  This class
050:         * is essentially a typesafe enumeration and the instances are immutable.
051:         *
052:         * @author <a href="arkin@intalio.com">Assaf Arkin</a>
053:         * @author <a href="kvisco@intalio.com">Keith Visco</a>
054:         * @version $Revision: 6761 $ $Date: 2003-03-03 00:05:44 -0700 (Mon, 03 Mar 2003) $
055:         */
056:        public final class NodeType {
057:
058:            /** The attribute type. */
059:            public static final short ATTRIBUTE = 0;
060:            /** The element type. */
061:            public static final short ELEMENT = 1;
062:            /** The namespace node type. */
063:            public static final short NAMESPACE = 2;
064:            /** The text type. */
065:            public static final short TEXT = 3;
066:            /** Attribute node type (<tt>attribute</tt>). This field will appear in
067:             * the XML document as an element's attribute. */
068:            public static final NodeType Attribute = new NodeType(
069:                    NodeType.ATTRIBUTE, "attribute");
070:            /** Element node type (<tt>element</tt>). This field will appear in the
071:             * XML document as a contained element. */
072:            public static final NodeType Element = new NodeType(
073:                    NodeType.ELEMENT, "element");
074:            /** Namespace node type (<tt>namespace</tt>). This field will appear in
075:             * the XML document as a namespace declaration. */
076:            public static final NodeType Namespace = new NodeType(
077:                    NodeType.NAMESPACE, "namespace");
078:            /** Content node type (<tt>text</tt>). This field will appear in the XML
079:             * document as the element text content. */
080:            public static final NodeType Text = new NodeType(NodeType.TEXT,
081:                    "text");
082:
083:            /** The name of this node type as it would appear in a mapping file. */
084:            private final String _name;
085:            /** The type of this NodeType. */
086:            private final short _type;
087:
088:            /**
089:             * Private constructor ... creates a new NodeType.
090:             * @param type Type of node
091:             * @param name Name for the node
092:             */
093:            private NodeType(final short type, final String name) {
094:                _type = type;
095:                _name = name;
096:            }
097:
098:            /**
099:             * Returns the node type from the name. If <tt>nodeType</tt> is null,
100:             * return the default node type ({@link #Attribute}). Otherwise returns
101:             * the named node type mode.
102:             *
103:             * @param nodeType The node type name
104:             * @return The node type
105:             */
106:            public static NodeType getNodeType(final String nodeType) {
107:                if (nodeType == null) {
108:                    return Attribute;
109:                }
110:                if (nodeType.equals(Attribute._name)) {
111:                    return Attribute;
112:                }
113:                if (nodeType.equals(Namespace._name)) {
114:                    return Namespace;
115:                }
116:                if (nodeType.equals(Element._name)) {
117:                    return Element;
118:                }
119:                if (nodeType.equals(Text._name)) {
120:                    return Text;
121:                }
122:                // We don't expect that this can happen without subclassing.
123:                throw new IllegalArgumentException("Unrecognized node type");
124:            }
125:
126:            /**
127:             * Returns the type of this NodeType.
128:             * @return the type of this NodeType.
129:             */
130:            public short getType() {
131:                return _type;
132:            }
133:
134:            /**
135:             * Returns the name of this NodeType.
136:             * @return the name of this NodeType.
137:             */
138:            public String toString() {
139:                return _name;
140:            }
141:
142:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.