Created
June 9, 2015 18:45
-
-
Save creationmachine/447314dccc0f522a0eb8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package models; | |
import java.util.ArrayList; | |
import java.util.Date; | |
import java.util.List; | |
import java.util.Random; | |
/** | |
* Sample Employee bean to demostrate simple export features | |
*/ | |
public class Employee { | |
private String name; | |
private int age; | |
private Double payment; | |
private Double bonus; | |
private Date birthDate; | |
private Employee superior; | |
static Random random = new Random(System.currentTimeMillis()); | |
static long current = System.currentTimeMillis(); | |
/** | |
* | |
* @param name | |
* @param age | |
* @param payment | |
* @param bonus | |
*/ | |
public Employee(String name, int age, Double payment, Double bonus) { | |
this.name = name; | |
this.age = age; | |
this.payment = payment; | |
this.bonus = bonus; | |
} | |
/** | |
* | |
* @param name | |
* @param age | |
* @param payment | |
* @param bonus | |
* @param birthDate | |
*/ | |
public Employee(String name, int age, double payment, double bonus, Date birthDate) { | |
this.name = name; | |
this.age = age; | |
this.payment = new Double(payment); | |
this.bonus = new Double(bonus); | |
this.birthDate = birthDate; | |
} | |
/** | |
* | |
* @param name | |
* @param age | |
* @param payment | |
* @param bonus | |
*/ | |
public Employee(String name, int age, double payment, double bonus) { | |
this.name = name; | |
this.age = age; | |
this.payment = new Double(payment); | |
this.bonus = new Double(bonus); | |
} | |
/** | |
* | |
* @param num | |
* @return | |
*/ | |
public static List<Employee> generate(int num){ | |
List<Employee> result = new ArrayList<Employee>(); | |
for(int index = 0; index < num; index++){ | |
result.add( generateOne("" + index) ); | |
} | |
return result; | |
} | |
/** | |
* | |
* @param nameSuffix | |
* @return | |
*/ | |
public static Employee generateOne(String nameSuffix){ | |
return new Employee("Employee " + nameSuffix, random.nextInt(100), 1000 + random.nextDouble()*5000, random.nextInt(100)/100.0d, new Date(current - (1000000 + random.nextInt(1000000)))); | |
} | |
/** | |
* | |
* @return | |
*/ | |
public String getName() { | |
return name; | |
} | |
/** | |
* | |
* @param name | |
*/ | |
public void setName(String name) { | |
this.name = name; | |
} | |
/** | |
* | |
* @return | |
*/ | |
public int getAge() { | |
return age; | |
} | |
/** | |
* | |
* @param age | |
*/ | |
public void setAge(int age) { | |
this.age = age; | |
} | |
/** | |
* | |
* @return | |
*/ | |
public Double getPayment() { | |
return payment; | |
} | |
/** | |
* | |
* @param payment | |
*/ | |
public void setPayment(Double payment) { | |
this.payment = payment; | |
} | |
/** | |
* | |
* @return | |
*/ | |
public Double getBonus() { | |
return bonus; | |
} | |
/** | |
* | |
* @param bonus | |
*/ | |
public void setBonus(Double bonus) { | |
this.bonus = bonus; | |
} | |
/** | |
* | |
* @return | |
*/ | |
public Date getBirthDate() { | |
return birthDate; | |
} | |
/** | |
* | |
* @param birthDate | |
*/ | |
public void setBirthDate(Date birthDate) { | |
this.birthDate = birthDate; | |
} | |
/** | |
* | |
* @return | |
*/ | |
public Employee getSuperior() { | |
return superior; | |
} | |
/** | |
* | |
* @param superior | |
*/ | |
public void setSuperior(Employee superior) { | |
this.superior = superior; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment