Source Code Cross Referenced for ValidationEventImpl.java in  » 6.0-JDK-Modules » jaxb-api » javax » xml » bind » helpers » 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 » jaxb api » javax.xml.bind.helpers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
003:         * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
004:         */
005:        package javax.xml.bind.helpers;
006:
007:        import java.text.MessageFormat;
008:
009:        import javax.xml.bind.ValidationEvent;
010:        import javax.xml.bind.ValidationEventLocator;
011:
012:        /**
013:         * Default implementation of the ValidationEvent interface.
014:         * 
015:         * <p>
016:         * JAXB providers are allowed to use whatever class that implements
017:         * the ValidationEvent interface. This class is just provided for a
018:         * convenience.
019:         *
020:         * @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li></ul> 
021:         * @version $Revision: 1.1 $
022:         * @see javax.xml.bind.Validator
023:         * @see javax.xml.bind.ValidationEventHandler
024:         * @see javax.xml.bind.ValidationEvent
025:         * @see javax.xml.bind.ValidationEventLocator
026:         * @since JAXB1.0
027:         */
028:        public class ValidationEventImpl implements  ValidationEvent {
029:
030:            /**
031:             * Create a new ValidationEventImpl.
032:             * 
033:             * @param _severity The severity value for this event.  Must be one of
034:             * ValidationEvent.WARNING, ValidationEvent.ERROR, or 
035:             * ValidationEvent.FATAL_ERROR
036:             * @param _message The text message for this event - may be null.
037:             * @param _locator The locator object for this event - may be null.
038:             * @throws IllegalArgumentException if an illegal severity field is supplied
039:             */
040:            public ValidationEventImpl(int _severity, String _message,
041:                    ValidationEventLocator _locator) {
042:
043:                this (_severity, _message, _locator, null);
044:            }
045:
046:            /**
047:             * Create a new ValidationEventImpl.
048:             * 
049:             * @param _severity The severity value for this event.  Must be one of
050:             * ValidationEvent.WARNING, ValidationEvent.ERROR, or 
051:             * ValidationEvent.FATAL_ERROR
052:             * @param _message The text message for this event - may be null.
053:             * @param _locator The locator object for this event - may be null.
054:             * @param _linkedException An optional linked exception that may provide
055:             * additional information about the event - may be null.
056:             * @throws IllegalArgumentException if an illegal severity field is supplied
057:             */
058:            public ValidationEventImpl(int _severity, String _message,
059:                    ValidationEventLocator _locator, Throwable _linkedException) {
060:
061:                setSeverity(_severity);
062:                this .message = _message;
063:                this .locator = _locator;
064:                this .linkedException = _linkedException;
065:            }
066:
067:            private int severity;
068:            private String message;
069:            private Throwable linkedException;
070:            private ValidationEventLocator locator;
071:
072:            public int getSeverity() {
073:                return severity;
074:            }
075:
076:            /**
077:             * Set the severity field of this event.  
078:             * 
079:             * @param _severity Must be one of ValidationEvent.WARNING, 
080:             * ValidationEvent.ERROR, or ValidationEvent.FATAL_ERROR.
081:             * @throws IllegalArgumentException if an illegal severity field is supplied
082:             */
083:            public void setSeverity(int _severity) {
084:
085:                if (_severity != ValidationEvent.WARNING
086:                        && _severity != ValidationEvent.ERROR
087:                        && _severity != ValidationEvent.FATAL_ERROR) {
088:                    throw new IllegalArgumentException(Messages
089:                            .format(Messages.ILLEGAL_SEVERITY));
090:                }
091:
092:                this .severity = _severity;
093:            }
094:
095:            public String getMessage() {
096:                return message;
097:            }
098:
099:            /**
100:             * Set the message field of this event.
101:             * 
102:             * @param _message String message - may be null.
103:             */
104:            public void setMessage(String _message) {
105:                this .message = _message;
106:            }
107:
108:            public Throwable getLinkedException() {
109:                return linkedException;
110:            }
111:
112:            /**
113:             * Set the linked exception field of this event.
114:             * 
115:             * @param _linkedException Optional linked exception - may be null.
116:             */
117:            public void setLinkedException(Throwable _linkedException) {
118:                this .linkedException = _linkedException;
119:            }
120:
121:            public ValidationEventLocator getLocator() {
122:                return locator;
123:            }
124:
125:            /**
126:             * Set the locator object for this event.
127:             * 
128:             * @param _locator The locator - may be null.
129:             */
130:            public void setLocator(ValidationEventLocator _locator) {
131:                this .locator = _locator;
132:            }
133:
134:            /**
135:             * Returns a string representation of this object in a format
136:             * helpful to debugging.
137:             * 
138:             * @see Object#equals(Object)
139:             */
140:            public String toString() {
141:                String s;
142:                switch (getSeverity()) {
143:                case WARNING:
144:                    s = "WARNING";
145:                    break;
146:                case ERROR:
147:                    s = "ERROR";
148:                    break;
149:                case FATAL_ERROR:
150:                    s = "FATAL_ERROR";
151:                    break;
152:                default:
153:                    s = String.valueOf(getSeverity());
154:                    break;
155:                }
156:                return MessageFormat.format(
157:                        "[severity={0},message={1},locator={2}]", new Object[] {
158:                                s, getMessage(), getLocator() });
159:            }
160:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.