Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @EJB(jndi="java:global/moduleName/ConcreteClassName:fullyQualifiedInterfaceName")
- ServiceI service;
- public abstract class Employee{
- String name;
- SalaryCalcService salaryService;
- }
- public interface SalaryCalcService {
- public double abstract calculateSalary();
- }
- public class PerMonthCalc implements SalaryCalcService {
- public double calculateSalary(Employee emp){
- //return something relevant....
- }
- }
- public class PerHourCalc implements SalaryCalcService {
- public double calculateSalary(Employee emp){
- //return something relevant....
- }
- }
- SalaryCalcService perMonth = new PerMonthCalc();
- SalaryCalcService perHour = new PerHourCalc();
- Employee emp1 = new Employee();
- emp1.serSalaryService(perMonth);
- //...
- for(Employee emp : employees){
- double salary = emp.getSalaryService().calculateSalary();
- }
Add Comment
Please, Sign In to add comment