Source Code Cross Referenced for Var.java in  » Library » Apache-commons-validator-1.3.1-src » org » apache » commons » validator » 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 » Library » Apache commons validator 1.3.1 src » org.apache.commons.validator 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:        package org.apache.commons.validator;
018:
019:        import java.io.Serializable;
020:
021:        /**
022:         * A variable that can be associated with a <code>Field</code> for
023:         * passing in information to a pluggable validator.  Instances of this class are
024:         * configured with a &lt;var&gt; xml element.
025:         *
026:         * @version $Revision: 478334 $ $Date: 2006-11-22 21:31:54 +0000 (Wed, 22 Nov 2006) $
027:         */
028:        public class Var implements  Cloneable, Serializable {
029:
030:            /**
031:             * Int Constant for JavaScript type.  This can be used
032:             * when auto-generating JavaScript.
033:             */
034:            public static final String JSTYPE_INT = "int";
035:
036:            /**
037:             * String Constant for JavaScript type.  This can be used
038:             * when auto-generating JavaScript.
039:             */
040:            public static final String JSTYPE_STRING = "string";
041:
042:            /**
043:             * Regular Expression Constant for JavaScript type.  This can be used
044:             * when auto-generating JavaScript.
045:             */
046:            public static final String JSTYPE_REGEXP = "regexp";
047:
048:            /**
049:             * The name of the variable.
050:             */
051:            private String name = null;
052:
053:            /**
054:             * The key or value the variable.
055:             */
056:            private String value = null;
057:
058:            /**
059:             * The optional JavaScript type of the variable.
060:             */
061:            private String jsType = null;
062:
063:            /**
064:             * Whether the variable is a resource [false]
065:             */
066:            private boolean resource = false;
067:
068:            /**
069:             * The bundle for a variable (when resource = 'true').
070:             */
071:            private String bundle = null;
072:
073:            /**
074:             * Default Constructor.
075:             */
076:            public Var() {
077:                super ();
078:            }
079:
080:            /**
081:             * Constructs a variable with a specified name, value
082:             * and Javascript type.
083:             * @param name Variable name.
084:             * @param value Variable value.
085:             * @param jsType Variable Javascript type.
086:             */
087:            public Var(String name, String value, String jsType) {
088:                this .name = name;
089:                this .value = value;
090:                this .jsType = jsType;
091:            }
092:
093:            /**
094:             * Gets the name of the variable.
095:             * @return The name of the variable.
096:             */
097:            public String getName() {
098:                return this .name;
099:            }
100:
101:            /**
102:             * Sets the name of the variable.
103:             * @param name The name of the variable.
104:             */
105:            public void setName(String name) {
106:                this .name = name;
107:            }
108:
109:            /**
110:             * Gets the value of the variable.
111:             * @return The value of the variable.
112:             */
113:            public String getValue() {
114:                return this .value;
115:            }
116:
117:            /**
118:             * Sets the value of the variable.
119:             * @param value The value of the variable.
120:             */
121:            public void setValue(String value) {
122:                this .value = value;
123:            }
124:
125:            /**
126:             * Tests whether or not the value is a resource key or literal value.
127:             * @return <code>true</code> if value is a resource key.
128:             * @since Validator 1.2.0
129:             */
130:            public boolean isResource() {
131:                return this .resource;
132:            }
133:
134:            /**
135:             * Sets whether or not the value is a resource.
136:             * @param resource If true indicates the value is a resource.
137:             * @since Validator 1.2.0
138:             */
139:            public void setResource(boolean resource) {
140:                this .resource = resource;
141:            }
142:
143:            /**
144:             * Returns the resource bundle name.
145:             * @return The bundle name.
146:             * @since Validator 1.2.0
147:             */
148:            public String getBundle() {
149:                return this .bundle;
150:            }
151:
152:            /**
153:             * Sets the resource bundle name.
154:             * @param bundle The new bundle name.
155:             * @since Validator 1.2.0
156:             */
157:            public void setBundle(String bundle) {
158:                this .bundle = bundle;
159:            }
160:
161:            /**
162:             * Gets the JavaScript type of the variable.
163:             * @return The Javascript type of the variable.
164:             */
165:            public String getJsType() {
166:                return this .jsType;
167:            }
168:
169:            /**
170:             * Sets the JavaScript type of the variable.
171:             * @param jsType The Javascript type of the variable.
172:             */
173:            public void setJsType(String jsType) {
174:                this .jsType = jsType;
175:            }
176:
177:            /**
178:             * Creates and returns a copy of this object.
179:             * @return A copy of the variable.
180:             */
181:            public Object clone() {
182:                try {
183:                    return super .clone();
184:
185:                } catch (CloneNotSupportedException e) {
186:                    throw new RuntimeException(e.toString());
187:                }
188:            }
189:
190:            /**
191:             * Returns a string representation of the object.
192:             * @return A string representation of the variable.
193:             */
194:            public String toString() {
195:                StringBuffer results = new StringBuffer();
196:
197:                results.append("Var: name=");
198:                results.append(name);
199:                results.append("  value=");
200:                results.append(value);
201:                results.append("  resource=");
202:                results.append(resource);
203:                if (resource) {
204:                    results.append("  bundle=");
205:                    results.append(bundle);
206:                }
207:                results.append("  jsType=");
208:                results.append(jsType);
209:                results.append("\n");
210:
211:                return results.toString();
212:            }
213:
214:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.