先写一个类,类中是抽象出来的方法;这里mo()方法是静态方法,直接用类调用;
public class test {
public static void mo(Communication comm,String errorDesc){
CollMonitor cm=new CollMonitor();
try {
cm.setProcessKind("tl1_collect");
cm.setProcessDesc("tl1采集");
cm.setHostIp(InetAddress.getLocalHost().getHostAddress());
cm.setOmcId(comm.getOmcConfig().getOmcId());
cm.setOmcName(comm.getOmcConfig().getOmcName());
cm.setAreaId(comm.getOmcConfig().getAreaId());
cm.setProcessState(2L);
cm.setErrorDesc(errorDesc);
cm.setMonitorLevel(2L);
cm.setExpose(1L);
cm.setFieldNodes("");
CommonBeanProvider.getCollMonitor().save(cm);
} catch (Exception e1) {
}
}
}
再在别一个类中调用这个抽象的方法,只需要传方法中的参数就可以了;在另一个类中,直接用test类调用静态mo()方法;
String erroDesc = "erroDesc";
String com ="hello";
test.mo(com,erroDesc);