Currently I'm working on a class that performs a batch process as per
scheduling for all employees in a company. Being a batch process load
is obviously a huge factor.
The process first needs to calculate the eligibility of each employee
before proceeding to the next stage. I need to cache some of the
employee information if an employee is found eligible for later use in
the next stage.
One option could be a javabean style value object class with all
required attributes and getter setter methods. However I would like to
avoid the overhead of these method calls for say 3000 eligible
employees. A lightweight object where I can access the attributes
directly would help me
I therefore propose an inner class....
class Process {
doEligibility () {
EmpInfo a = new EmpInfo();
a.attrib1 = //set it
a.attrib2 = //set it
//store in hashmap with empID as key
}
private Class EmpInfo { //INNER CLASS
int attrib1;
String attrib2;
.....
}
doProcess {
EmpInfo a = (EmpInfo) map.get("empID");
//use the attributes directly
}
}
Is this wrong/bad design ?? If so, what is a better way to achieve
this ???