Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
1.3 kB
2
Indexable
Never
public abstract class Bank {
    protected Office office = buildOffice();
    protected List<Employee> staff = Staff.hireEmployees();
 
    public void transfer(Client a, Client b, double amount, String currency) {
        a.documents.passport.seriesAndNumber.validate();
 
        if (a.type == "type1") {
            // do something
        } else if (a.type == "type2") {
            // do another thing
        } else if (a.type == "type3") {
            // do other thing
        }
 
        // ...
    }
 
    public abstract Office buildOffice();
 
    // invoked on every frame update on UI
    public UIBankInfo render() {
        UIBankInfo bankInfoFrame = new UIBankInfo();
        bankInfoFrame.setBankInfo(generateBankInfo());
        // ...
 
        return bankInfoFrame;
    }
 
    public BankInfo generateBankInfo() {
        BankInfo bankInfo = new BankInfo();
        // ...
 
        return bankInfo;
    }
}
 
public class SberBank extends Bank {
    public Office buildOffice() {
        OfficeBuilder builder = new SomeBuildingCompany();
        return builder.use(staff).buildOffice();
    }
 
    public BankInfo generateBankInfo() {
        BankInfo bankInfo = super.generateBankInfo();
        notifyEmail(Config.getAdminEmail());
 
        return bankInfo;
    }
}