Source Code Cross Referenced for AddressModel.java in  » Mail-Clients » columba-1.4 » org » columba » addressbook » model » 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 » Mail Clients » columba 1.4 » org.columba.addressbook.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // The contents of this file are subject to the Mozilla Public License Version
002:        // 1.1
003:        //(the "License"); you may not use this file except in compliance with the
004:        //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
005:        //
006:        //Software distributed under the License is distributed on an "AS IS" basis,
007:        //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
008:        //for the specific language governing rights and
009:        //limitations under the License.
010:        //
011:        //The Original Code is "The Columba Project"
012:        //
013:        //The Initial Developers of the Original Code are Frederik Dietz and Timo
014:        // Stich.
015:        //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
016:        //
017:        //All Rights Reserved.
018:        package org.columba.addressbook.model;
019:
020:        public class AddressModel {
021:
022:            public static final String[] NAMES = new String[] { "work", "home",
023:                    "other" };
024:
025:            public static final int TYPE_WORK = 0;
026:
027:            public static final int TYPE_HOME = 1;
028:
029:            public static final int TYPE_OTHER = 2;
030:
031:            private String poBox;
032:
033:            private String street;
034:
035:            private String city;
036:
037:            private String zipPostalCode;
038:
039:            private String stateProvinceCounty;
040:
041:            private String country;
042:
043:            private String label;
044:
045:            int type;
046:
047:            public AddressModel(String poBox, String street, String city,
048:                    String zipPostalCode, String stateProvinceCounty,
049:                    String country, String label, String type) {
050:
051:                // TODO: throw IllegalArgumentException in case a variable == null
052:                boolean foundMatch = false;
053:                for (int i = 0; i < NAMES.length; i++) {
054:                    if (type.equals(NAMES[i])) {
055:                        foundMatch = true;
056:                        this .type = i;
057:                    }
058:                }
059:
060:                if (!foundMatch)
061:                    throw new IllegalArgumentException("unsupported type ="
062:                            + type);
063:
064:                this .poBox = poBox;
065:                this .street = street;
066:                this .city = city;
067:                this .zipPostalCode = zipPostalCode;
068:                this .stateProvinceCounty = stateProvinceCounty;
069:                this .country = country;
070:                this .label = label;
071:            }
072:
073:            public AddressModel(String poBox, String street, String city,
074:                    String zipPostalCode, String stateProvinceCounty,
075:                    String country, String label, int type) {
076:
077:                // TODO: throw IllegalArgumentException in case a variable == null
078:
079:                if (type < 0 || type > 2)
080:                    throw new IllegalArgumentException("unsupported type ="
081:                            + type);
082:
083:                this .poBox = poBox;
084:                this .street = street;
085:                this .city = city;
086:                this .zipPostalCode = zipPostalCode;
087:                this .stateProvinceCounty = stateProvinceCounty;
088:                this .country = country;
089:                this .type = type;
090:                this .label = label;
091:            }
092:
093:            public String getTypeString() {
094:                if (type == 0)
095:                    return "work";
096:                if (type == 1)
097:                    return "home";
098:                if (type == 2)
099:                    return "other";
100:                else
101:                    throw new IllegalArgumentException("type not supported");
102:            }
103:
104:            /**
105:             * @return Returns the city.
106:             */
107:            public String getCity() {
108:                return city;
109:            }
110:
111:            /**
112:             * @return Returns the country.
113:             */
114:            public String getCountry() {
115:                return country;
116:            }
117:
118:            /**
119:             * @return Returns the poBox.
120:             */
121:            public String getPoBox() {
122:                return poBox;
123:            }
124:
125:            /**
126:             * @return Returns the stateProvinceCounty.
127:             */
128:            public String getStateProvinceCounty() {
129:                return stateProvinceCounty;
130:            }
131:
132:            /**
133:             * @return Returns the zipPostalCode.
134:             */
135:            public String getZipPostalCode() {
136:                return zipPostalCode;
137:            }
138:
139:            /**
140:             * @return Returns the type.
141:             */
142:            public int getType() {
143:                return type;
144:            }
145:
146:            /**
147:             * @return Returns the street.
148:             */
149:            public String getStreet() {
150:                return street;
151:            }
152:
153:            /**
154:             * @return Returns the label.
155:             */
156:            public String getLabel() {
157:                return label;
158:            }
159:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.