/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.camel.dataformat.beanio; import java.util.Date; public class Employee { private String firstName; private String lastName; private String title; private int salary; private Date hireDate; public Employee() { } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public int getSalary() { return salary; } public void setSalary(int salary) { this.salary = salary; } public Date getHireDate() { return hireDate; } public void setHireDate(Date hireDate) { this.hireDate = hireDate; } @Override public int hashCode() { int result = firstName != null ? firstName.hashCode() : 0; result = 31 * result + (lastName != null ? lastName.hashCode() : 0); result = 31 * result + (title != null ? title.hashCode() : 0); result = 31 * result + salary; result = 31 * result + (hireDate != null ? hireDate.hashCode() : 0); return result; } @Override public boolean equals(Object object) { if (object == null) { return false; } else if (object == this) { return true; } else if (!(object instanceof Employee)) { return false; } Employee e = (Employee) object; return this.getFirstName().equals(e.getFirstName()) && this.getLastName().equals(e.getLastName()) && this.getTitle().equals(e.getTitle()) && this.getSalary() == e.getSalary() && this.getHireDate().equals(e.getHireDate()); } @Override public String toString() { return "Employee{" + "firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", title='" + title + '\'' + ", salary=" + salary + ", hireDate=" + hireDate + '}'; } }