日志分析类的回想
最开始采用的是每个页面对应一个方法,这样6个页面用了6个方法,其实里面的核心方法都差不多。此时代码加起来差不多1200行。
晚上想了想用运行时判断此类的类型,通过instanceof具体类型,这样就只用一个方法就可以搞定
else if (baseLog instanceof TAtyLogFrameLogin
&& ((TAtyLogFrameLogin) baseLog).getCFrameId() != null
&& yaxis.equals("6")
&& yaxisValue.equals(((TAtyLogFrameLogin) baseLog)
.getCFrameId())) {// browser
logNumber++;
}
这样下来精简的代码差不多500行