Source Code Cross Referenced for ActionMessage.java in  » Web-Framework » struts-1.3.8 » org » apache » struts » action » 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 Framework » struts 1.3.8 » org.apache.struts.action 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: ActionMessage.java 471754 2006-11-06 14:55:09Z husted $
003:         *
004:         * Licensed to the Apache Software Foundation (ASF) under one
005:         * or more contributor license agreements.  See the NOTICE file
006:         * distributed with this work for additional information
007:         * regarding copyright ownership.  The ASF licenses this file
008:         * to you under the Apache License, Version 2.0 (the
009:         * "License"); you may not use this file except in compliance
010:         * with the License.  You may obtain a copy of the License at
011:         *
012:         *  http://www.apache.org/licenses/LICENSE-2.0
013:         *
014:         * Unless required by applicable law or agreed to in writing,
015:         * software distributed under the License is distributed on an
016:         * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
017:         * KIND, either express or implied.  See the License for the
018:         * specific language governing permissions and limitations
019:         * under the License.
020:         */
021:        package org.apache.struts.action;
022:
023:        import java.io.Serializable;
024:
025:        /**
026:         * <p>An encapsulation of an individual message returned by the
027:         * <code>validate</code> method of an <code>ActionForm</code>, consisting of a
028:         * message key (to be used to look up message text in an appropriate message
029:         * resources database) plus up to four placeholder objects that can be used
030:         * for parametric replacement in the message text.</p>
031:         *
032:         * @version $Rev: 471754 $ $Date: 2005-05-14 01:09:32 -0400 (Sat, 14 May 2005)
033:         *          $
034:         * @since Struts 1.1
035:         */
036:        public class ActionMessage implements  Serializable {
037:            // ----------------------------------------------------- Instance Variables
038:
039:            /**
040:             * <p>The message key for this message.</p>
041:             */
042:            protected String key = null;
043:
044:            /**
045:             * <p>The replacement values for this mesasge.</p>
046:             */
047:            protected Object[] values = null;
048:
049:            /**
050:             * <p>Indicates whether the key is taken to be as a  bundle key [true] or
051:             * literal value [false].</p>
052:             */
053:            protected boolean resource = true;
054:
055:            // ----------------------------------------------------------- Constructors
056:
057:            /**
058:             * <p>Construct an action message with no replacement values.</p>
059:             *
060:             * @param key Message key for this message
061:             */
062:            public ActionMessage(String key) {
063:                this (key, null);
064:            }
065:
066:            /**
067:             * <p>Construct an action message with the specified replacement
068:             * values.</p>
069:             *
070:             * @param key    Message key for this message
071:             * @param value0 First replacement value
072:             */
073:            public ActionMessage(String key, Object value0) {
074:                this (key, new Object[] { value0 });
075:            }
076:
077:            /**
078:             * <p>Construct an action message with the specified replacement
079:             * values.</p>
080:             *
081:             * @param key    Message key for this message
082:             * @param value0 First replacement value
083:             * @param value1 Second replacement value
084:             */
085:            public ActionMessage(String key, Object value0, Object value1) {
086:                this (key, new Object[] { value0, value1 });
087:            }
088:
089:            /**
090:             * <p>Construct an action message with the specified replacement
091:             * values.</p>
092:             *
093:             * @param key    Message key for this message
094:             * @param value0 First replacement value
095:             * @param value1 Second replacement value
096:             * @param value2 Third replacement value
097:             */
098:            public ActionMessage(String key, Object value0, Object value1,
099:                    Object value2) {
100:                this (key, new Object[] { value0, value1, value2 });
101:            }
102:
103:            /**
104:             * <p>Construct an action message with the specified replacement
105:             * values.</p>
106:             *
107:             * @param key    Message key for this message
108:             * @param value0 First replacement value
109:             * @param value1 Second replacement value
110:             * @param value2 Third replacement value
111:             * @param value3 Fourth replacement value
112:             */
113:            public ActionMessage(String key, Object value0, Object value1,
114:                    Object value2, Object value3) {
115:                this (key, new Object[] { value0, value1, value2, value3 });
116:            }
117:
118:            /**
119:             * <p>Construct an action message with the specified replacement
120:             * values.</p>
121:             *
122:             * @param key    Message key for this message
123:             * @param values Array of replacement values
124:             */
125:            public ActionMessage(String key, Object[] values) {
126:                this .key = key;
127:                this .values = values;
128:                this .resource = true;
129:            }
130:
131:            /**
132:             * <p>Construct an action message with the specified replacement
133:             * values.</p>
134:             *
135:             * @param key      Message key for this message
136:             * @param resource Indicates whether the key is a bundle key or literal
137:             *                 value
138:             */
139:            public ActionMessage(String key, boolean resource) {
140:                this .key = key;
141:                this .resource = resource;
142:            }
143:
144:            // --------------------------------------------------------- Public Methods
145:
146:            /**
147:             * <p>Get the message key for this message.</p>
148:             *
149:             * @return The message key for this message.
150:             */
151:            public String getKey() {
152:                return (this .key);
153:            }
154:
155:            /**
156:             * <p>Get the replacement values for this message.</p>
157:             *
158:             * @return The replacement values for this message.
159:             */
160:            public Object[] getValues() {
161:                return (this .values);
162:            }
163:
164:            /**
165:             * <p>Indicate whether the key is taken to be as a  bundle key [true] or
166:             * literal value [false].</p>
167:             *
168:             * @return <code>true</code> if the key is a bundle key;
169:             *         <code>false</code> otherwise.
170:             */
171:            public boolean isResource() {
172:                return (this .resource);
173:            }
174:
175:            /**
176:             * <p>Returns a String in the format: key[value1, value2, etc].</p>
177:             *
178:             * @return String representation of this message
179:             * @see java.lang.Object#toString()
180:             */
181:            public String toString() {
182:                StringBuffer buff = new StringBuffer();
183:
184:                buff.append(this .key);
185:                buff.append("[");
186:
187:                if (this .values != null) {
188:                    for (int i = 0; i < this .values.length; i++) {
189:                        buff.append(this .values[i]);
190:
191:                        // don't append comma to last entry
192:                        if (i < (this .values.length - 1)) {
193:                            buff.append(", ");
194:                        }
195:                    }
196:                }
197:
198:                buff.append("]");
199:
200:                return buff.toString();
201:            }
202:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.