1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
| package cn.studybigdata.hadoop.mapred.dpartition;
import org.apache.hadoop.io.Writable;
import java.io.DataInput; import java.io.DataOutput; import java.io.IOException;
public class Employee implements Writable { private int empId; private String name; private String position; private int otherId; private String hireDate; private int salary; private int bonus; private int deptId;
public int getEmpId() { return empId; }
public void setEmpId(int empId) { this.empId = empId; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getPosition() { return position; }
public void setPosition(String position) { this.position = position; }
public int getOtherId() { return otherId; }
public void setOtherId(int otherId) { this.otherId = otherId; }
public String getHireDate() { return hireDate; }
public void setHireDate(String hireDate) { this.hireDate = hireDate; }
public int getSalary() { return salary; }
public void setSalary(int salary) { this.salary = salary; }
public int getBonus() { return bonus; }
public void setBonus(int bonus) { this.bonus = bonus; }
public int getDeptId() { return deptId; }
public void setDeptId(int deptId) { this.deptId = deptId; }
public Employee() { }
public Employee(int empId, String name, String position, int otherId, String hireDate, int salary, int bonus, int deptId) { this.empId = empId; this.name = name; this.position = position; this.otherId = otherId; this.hireDate = hireDate; this.salary = salary; this.bonus = bonus; this.deptId = deptId; }
@Override public String toString() { return "Employee{" + "empId=" + empId + ", name='" + name + '\'' + ", position='" + position + '\'' + ", otherId=" + otherId + ", hireDate='" + hireDate + '\'' + ", salary=" + salary + ", bonus=" + bonus + ", deptId=" + deptId + '}'; }
@Override public void write(DataOutput out) throws IOException { out.writeInt(this.empId); out.writeUTF(this.name); out.writeUTF(this.position); out.writeInt(this.otherId); out.writeUTF(this.hireDate); out.writeInt(this.salary); out.writeInt(this.bonus); out.writeInt(this.deptId); }
@Override public void readFields(DataInput in) throws IOException { this.empId = in.readInt(); this.name = in.readUTF(); this.position = in.readUTF(); this.otherId = in.readInt(); this.hireDate = in.readUTF(); this.salary = in.readInt(); this.bonus = in.readInt(); this.deptId = in.readInt(); }
}
|