Source Code Cross Referenced for PhoneNumber.java in  » Testing » databene-benerator » org » databene » region » 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 » Testing » databene benerator » org.databene.region 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * (c) Copyright 2007 by Volker Bergmann. All rights reserved.
003:         *
004:         * Redistribution and use in source and binary forms, with or without
005:         * modification, is permitted under the terms of the
006:         * GNU General Public License.
007:         *
008:         * For redistributing this software or a derivative work under a license other
009:         * than the GPL-compatible Free Software License as defined by the Free
010:         * Software Foundation or approved by OSI, you must first obtain a commercial
011:         * license to this software product from Volker Bergmann.
012:         *
013:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
014:         * WITHOUT A WARRANTY OF ANY KIND. ALL EXPRESS OR IMPLIED CONDITIONS,
015:         * REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF
016:         * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE
017:         * HEREBY EXCLUDED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
018:         * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
019:         * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
020:         * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
021:         * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
022:         * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
023:         * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
024:         * POSSIBILITY OF SUCH DAMAGE.
025:         */
026:
027:        package org.databene.region;
028:
029:        import org.databene.commons.Escalator;
030:        import org.databene.commons.LoggerEscalator;
031:
032:        /**
033:         * Represents a phone number.<br/>
034:         * <br/>
035:         * Created: 13.06.2006 07:19:26
036:         * @author Volker Bergmann
037:         */
038:        public class PhoneNumber {
039:
040:            private static final Escalator escalator = new LoggerEscalator();
041:
042:            private String countryCode;
043:            private String areaCode;
044:            private String localNumber;
045:
046:            private boolean mobile;
047:
048:            // constructors ----------------------------------------------------------------------------------------------------
049:
050:            public PhoneNumber() {
051:                this ("", "", "");
052:            }
053:
054:            public PhoneNumber(String countryCode, String cityCode,
055:                    String localNumber) {
056:                this (countryCode, cityCode, localNumber, false);
057:            }
058:
059:            public PhoneNumber(String countryCode, String cityCode,
060:                    String localNumber, boolean mobile) {
061:                this .countryCode = countryCode;
062:                this .areaCode = cityCode;
063:                this .localNumber = localNumber;
064:                this .mobile = mobile;
065:            }
066:
067:            // properties ------------------------------------------------------------------------------------------------------
068:
069:            public String getCountryCode() {
070:                return countryCode;
071:            }
072:
073:            public void setCountryCode(String countryCode) {
074:                this .countryCode = countryCode;
075:            }
076:
077:            public String getAreaCode() {
078:                return areaCode;
079:            }
080:
081:            public void setAreaCode(String cityCode) {
082:                this .areaCode = cityCode;
083:            }
084:
085:            /**
086:             * @return
087:             * @deprecated replaced with {@link #getAreaCode()}
088:             */
089:            public String getCityCode() {
090:                escalator.escalate(getClass().getSimpleName()
091:                        + ".getCityCode() is deprecated. "
092:                        + "Use getAreaCode() instead", getClass(), null);
093:                return areaCode;
094:            }
095:
096:            /**
097:             * @param areaCode
098:             * @deprecated replaced with {@link #setAreaCode(String)}
099:             */
100:            public void setCityCode(String areaCode) {
101:                escalator.escalate(getClass().getSimpleName()
102:                        + ".setCityCode(String) is deprecated. "
103:                        + "Use setAreaCode(String) instead", getClass(), null);
104:                this .areaCode = areaCode;
105:            }
106:
107:            public String getLocalNumber() {
108:                return localNumber;
109:            }
110:
111:            public void setLocalNumber(String localNumber) {
112:                this .localNumber = localNumber;
113:            }
114:
115:            /**
116:             * @return
117:             * @deprecated replaced with {@link #getLocalNumber()}
118:             */
119:            public String getLocalCode() {
120:                escalator.escalate(getClass().getSimpleName()
121:                        + ".getLocalCode() is deprecated. "
122:                        + "Use getLocalNumber() instead", getClass(), null);
123:                return localNumber;
124:            }
125:
126:            /**
127:             * @param localCode
128:             * @deprecated replaced with {@link #setLocalCode(String)}
129:             */
130:            public void setLocalCode(String localCode) {
131:                escalator.escalate(getClass().getSimpleName()
132:                        + ".setLocalCode() is deprecated. "
133:                        + "Use setLocalNumber() instead", getClass(), null);
134:                this .localNumber = localCode;
135:            }
136:
137:            public boolean isMobile() {
138:                return mobile;
139:            }
140:
141:            public void setMobile(boolean mobile) {
142:                this .mobile = mobile;
143:            }
144:
145:            // java.lang.Object overrides --------------------------------------------------------------------------------------
146:
147:            public String toString() {
148:                return "+" + countryCode + '-' + areaCode + '-' + localNumber;
149:            }
150:
151:            @Override
152:            public int hashCode() {
153:                final int prime = 31;
154:                int result = 1;
155:                result = prime * result
156:                        + ((areaCode == null) ? 0 : areaCode.hashCode());
157:                result = prime * result
158:                        + ((countryCode == null) ? 0 : countryCode.hashCode());
159:                result = prime * result
160:                        + ((localNumber == null) ? 0 : localNumber.hashCode());
161:                return result;
162:            }
163:
164:            @Override
165:            public boolean equals(Object obj) {
166:                if (this  == obj)
167:                    return true;
168:                if (obj == null)
169:                    return false;
170:                if (getClass() != obj.getClass())
171:                    return false;
172:                final PhoneNumber other = (PhoneNumber) obj;
173:                if (areaCode == null) {
174:                    if (other.areaCode != null)
175:                        return false;
176:                } else if (!areaCode.equals(other.areaCode))
177:                    return false;
178:                if (countryCode == null) {
179:                    if (other.countryCode != null)
180:                        return false;
181:                } else if (!countryCode.equals(other.countryCode))
182:                    return false;
183:                if (localNumber == null) {
184:                    if (other.localNumber != null)
185:                        return false;
186:                } else if (!localNumber.equals(other.localNumber))
187:                    return false;
188:                return true;
189:            }
190:
191:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.