public without sharing class ProductTypesHandler extends Oly_TriggerHandler {
    private Map<Id, ProductTypes__c> newMap;
    private Map<Id, ProductTypes__c> oldMap;
    private List<ProductTypes__c> newList;
    private List<ProductTypes__c> oldList;
    public ProductTypesHandler() {
        this.newMap = (Map<Id, ProductTypes__c>) Trigger.newMap;
        this.oldMap = (Map<Id, ProductTypes__c>) Trigger.oldMap;
        this.newList = (List<ProductTypes__c>) Trigger.new;
        this.oldList = (List<ProductTypes__c>) Trigger.old;
    }

    protected override void beforeInsert() {
        beforeSetValue();
    }

    protected override void beforeUpdate() {
        beforeSetValue();
    }

    private void beforeSetValue() {
        for (ProductTypes__c nObj : newList) {
            if (String.isBlank(nObj.Department_Cateogy__c) == false) {
                nObj.Department_Cateogy_Text__c = nObj.Department_Cateogy__c + ';';
                nObj.Name2__c = nObj.Name;
            }
        }
    }
}