Source Code Cross Referenced for Employee.java in  » Development » CSVObjects » test » net » sf » anupam » csv » beans » 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 » Development » CSVObjects » test.net.sf.anupam.csv.beans 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Employee.java 
003:         * 
004:         * Copyright (C) 2005 Anupam Sengupta (anupamsg@users.sourceforge.net) 
005:         * 
006:         * This program is free software; you can redistribute it and/or 
007:         * modify it under the terms of the GNU General Public License 
008:         * as published by the Free Software Foundation; either version 2 
009:         * of the License, or (at your option) any later version. 
010:         * 
011:         * This program is distributed in the hope that it will be useful, 
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of 
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
014:         * GNU General Public License for more details. 
015:         * 
016:         * You should have received a copy of the GNU General Public License
017:         * along with this program; if not, write to the Free Software 
018:         * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 
019:         *
020:         * Version $Revision: 1.2 $
021:         */
022:        package test.net.sf.anupam.csv.beans;
023:
024:        import org.apache.commons.lang.builder.CompareToBuilder;
025:        import org.apache.commons.lang.builder.EqualsBuilder;
026:        import org.apache.commons.lang.builder.HashCodeBuilder;
027:        import org.apache.commons.lang.builder.ToStringBuilder;
028:
029:        /**
030:         * Sample bean to represent an employee.
031:         *
032:         * @author Anupam Sengupta
033:         * @version $Revision: 1.2 $
034:         * @csv.bean-mapping bean-name="employeeBean" csv-header="true"
035:         */
036:        public class Employee implements  Comparable<Employee> {
037:            // ~ Instance fields
038:            // --------------------------------------------------------
039:
040:            /**
041:             * Employee ID.
042:             */
043:            private String employeeID;
044:
045:            /**
046:             * First name of the employee.
047:             */
048:            private String firstName;
049:
050:            /**
051:             * Last name of the employee.
052:             */
053:            private String lastName;
054:
055:            /**
056:             * The client supplied identifier.
057:             */
058:            private String clientSuppliedID;
059:
060:            /**
061:             * An alternate client supplied identifier.
062:             */
063:            private String clientSuppliedSecondaryID;
064:
065:            /**
066:             * the designation of this employee.
067:             */
068:            private Designation designation;
069:
070:            /**
071:             * Default Constructor.
072:             */
073:            public Employee() {
074:                super ();
075:            }
076:
077:            /**
078:             * Returns value of the clientSuppliedID.
079:             *
080:             * @return Returns the clientSuppliedID.
081:             * @csv.field-mapping field-name="MyTimeID" position="8"
082:             */
083:            public String getClientSuppliedID() {
084:                return this .clientSuppliedID;
085:            }
086:
087:            /**
088:             * Sets value of the clientSuppliedID.
089:             *
090:             * @param clientSuppliedID The clientSuppliedID to set.
091:             */
092:            public void setClientSuppliedID(final String clientSuppliedID) {
093:                this .clientSuppliedID = clientSuppliedID;
094:            }
095:
096:            /**
097:             * Returns value of the clientSuppliedSecondaryID.
098:             *
099:             * @return Returns the clientSuppliedSecondaryID.
100:             * @csv.field-mapping field-name="contractorID" position="7"
101:             */
102:            public String getClientSuppliedSecondaryID() {
103:                return this .clientSuppliedSecondaryID;
104:            }
105:
106:            /**
107:             * Sets value of the clientSuppliedSecondaryID.
108:             *
109:             * @param clientSuppliedSecondaryID The clientSuppliedSecondaryID to set.
110:             */
111:            public void setClientSuppliedSecondaryID(
112:                    final String clientSuppliedSecondaryID) {
113:                this .clientSuppliedSecondaryID = clientSuppliedSecondaryID;
114:            }
115:
116:            /**
117:             * Sets the employee ID.
118:             *
119:             * @param employeeID The employeeID to set.
120:             */
121:            public void setEmployeeID(final String employeeID) {
122:                this .employeeID = employeeID;
123:            }
124:
125:            /**
126:             * Return the employee ID.
127:             *
128:             * @return Returns the employeeID.
129:             * @csv.field-mapping position="1"
130:             */
131:            public String getEmployeeID() {
132:                return this .employeeID;
133:            }
134:
135:            /**
136:             * Set the first name.
137:             *
138:             * @param firstName The firstName to set.
139:             */
140:            public void setFirstName(final String firstName) {
141:                this .firstName = firstName;
142:            }
143:
144:            /**
145:             * Returns the first name.
146:             *
147:             * @return Returns the firstName.
148:             * @csv.field-mapping position="2" reformat="firstWord"
149:             */
150:            public String getFirstName() {
151:                return this .firstName;
152:            }
153:
154:            /**
155:             * Sets the last name.
156:             *
157:             * @param lastName The lastName to set.
158:             */
159:            public void setLastName(final String lastName) {
160:                this .lastName = lastName;
161:            }
162:
163:            /**
164:             * Returns the last name.
165:             *
166:             * @return Returns the lastName.
167:             * @csv.field-mapping position="2" reformat="lastWord"
168:             */
169:            public String getLastName() {
170:                return this .lastName;
171:            }
172:
173:            /**
174:             * Compares this employee against another employee for ordering purposes. The comparision
175:             * is based on the employee ID.
176:             *
177:             * @param other the other employee to compare against
178:             * @return <code>0</code> if the two employee are equal, <code>-1</code> if this employee ID
179:             *         is lower, <code>+1</code> if this employee ID is higher
180:             * @see Comparable#compareTo(Object)
181:             */
182:            public int compareTo(final Employee other) {
183:
184:                return new CompareToBuilder().append(employeeID,
185:                        other.employeeID).toComparison();
186:            }
187:
188:            /**
189:             * Compares this employee against another for equality. The comparision is based on the
190:             * employee ID.
191:             *
192:             * @param other the other employee to compare against
193:             * @return <code>true</code> if equal, <code>false</code> otherwise
194:             * @see Object#equals(Object)
195:             */
196:            @Override
197:            public boolean equals(final Object other) {
198:                if (this  == other) {
199:                    return true;
200:                }
201:
202:                if (!(other instanceof  Employee)) {
203:                    return false;
204:                }
205:
206:                final Employee castOther = (Employee) other;
207:
208:                return new EqualsBuilder().append(employeeID,
209:                        castOther.employeeID).isEquals();
210:            }
211:
212:            /**
213:             * Returns the hashcode for this employee. The hash code is based on the employee ID.
214:             *
215:             * @return the hash code
216:             * @see Object#hashCode()
217:             */
218:            @Override
219:            public int hashCode() {
220:                return new HashCodeBuilder().append(employeeID).toHashCode();
221:            }
222:
223:            /**
224:             * Returns a string representation of this employee for <code>debugging</code> purposes
225:             * only.
226:             *
227:             * @return the string representation
228:             * @see Object#toString()
229:             */
230:            @Override
231:            public String toString() {
232:                return new ToStringBuilder(this ).append("employeeID",
233:                        employeeID).append("firstName", firstName).append(
234:                        "lastName", lastName).append("clientSuppliedID",
235:                        clientSuppliedID).append("clientSuppliedSecondayID",
236:                        clientSuppliedSecondaryID).append("designation",
237:                        designation).toString();
238:            }
239:
240:            /**
241:             * Returns value of the designation.
242:             *
243:             * @return Returns the designation.
244:             * @csv.field-mapping position="3" bean-ref="designationBean"
245:             */
246:            public Designation getDesignation() {
247:                return this .designation;
248:            }
249:
250:            /**
251:             * Sets value of the designation.
252:             *
253:             * @param designation The designation to set.
254:             */
255:            public void setDesignation(final Designation designation) {
256:                this.designation = designation;
257:            }
258:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.