How to make a call to interface method from the class which implements this interface
public interface IA {
void m1();
}
public abstract class A implements IA {
void m2() {/*how to make a call to m1 here*/ }
}
public class AClass extends A {
void m1();
}
For example what is wrong in execute method so that I can't call methods identified in interface.
public class TriggerManager {
public interface ITriggerHandler {//TriggerManager.ITriggerHandler
void onBeforeInsert(List<sObject> newRecords);
void onBeforeUpdate(List<SObject> oldRecords, List<SObject> newRecords, Map<ID, SObject> oldRecordsMap, Map<ID, SObject> newRecordsMap);
void onBeforeDelete(List<sObject> oldRecords, Map<ID, sObject> oldRecordsMap);
void onAfterInsert(List<sObject> newRecords, Map<ID, sObject> newRecordsMap);
void onAfterUpdate(List<sObject> oldRecords, List<sObject> newRecords, Map<ID, sObject> oldRecordsMap, Map<ID, sObject> newRecordsMap);
void onAfterDelete(List<sObject> oldRecords, Map<ID, sObject> oldRecordsMap);
}
public abstract class TriggerHandler implements ITriggerHandler {
private void execute(Boolean isBefore, Boolean isAfter, Boolean isInsert, Boolean isUpdate, Boolean isDelete,
List<SObject> oldRecords, List<SObject> newRecords, Map<ID, SObject> oldRecordsMap, Map<ID, SObject> newRecordsMap) {
/*
if(isBefore) {
if (isInsert) onBeforeInsert(newRecords);
else if (isUpdate) onBeforeUpdate(oldRecords, newRecords, oldRecordsMap, newRecordsMap);
else if (isDelete) onBeforeDelete(oldRecords, oldRecordsMap);
}
else {
if (isInsert) onAfterInsert(newRecords, newRecordsMap);
else if (isUpdate) onAfterUpdate(oldRecords, newRecords, oldRecordsMap, newRecordsMap);
else if (isDelete) onAfterDelete(oldRecords, oldRecordsMap);
}
*/
}
}
public static void handle(TriggerHandler handler) {
handler.execute(
Trigger.isBefore,
Trigger.isAfter,
Trigger.isInsert,
Trigger.isUpdate,
Trigger.isDelete,
Trigger.old,
Trigger.new,
Trigger.oldMap,
Trigger.newMap);
}
}
What other items did I miss in this architecture?