}
@Override
public BaseProduct disposeServer(int id, String data) {
BaseProduct baseProduct = null;
switch (id) {
case 3:
baseProduct = new Product3();
break;
case 4:
baseProduct = new Product4();
break;
case 5:
baseProduct = new Product5();
break;
case 6:
baseProduct = new Product6();
break;
case 11:
baseProduct = new Product11();
break;
case 12:
baseProduct = new Product12();
break;
case 13:
baseProduct = new Product13();
break;
case 14:
baseProduct = new Product14();
break;
case 15:
baseProduct = new Product15();
break;
case 16:
baseProduct = new Product16();
break;
}
return baseProduct;
}
}
c、统一的产品接口
public abstract interface BaseProduct {
public String TAG = BaseProduct.class.getClass().getSimpleName();
/**
* 服务器过来的数据
*/
public abstract void proceServer(String code, String data);
/**
* 串口过来的数据
*
* @param data
*/
public abstract void proceSerial(int code, int opertion, String data);
}
d、各个产品类
public class Product4 implements BaseProduct {
@Override
public void proceServer(String code, String data) {
Log.e(TAG, "data:" + data);
}
@Override
public void proceSerial(int code, int opertion, String data) {
}
}
…只列出一个产品类,其他各个产品和这个产品一样
### 架构学习资料
![准备两个月,面试五分钟,Java中高级岗面试为何越来越难?](https://img-blog.csdnimg.cn/img_convert/8df60bbec486208f60e99de6ed928f2b.webp?x-oss-process=image/format,png)
![准备两个月,面试五分钟,Java中高级岗面试为何越来越难?](https://img-blog.csdnimg.cn/img_convert/5207aa286b3be08221078a3b9f06b797.webp?x-oss-process=image/format,png)
![准备两个月,面试五分钟,Java中高级岗面试为何越来越难?](https://img-blog.csdnimg.cn/img_convert/7c75244fa5a2154111388d692000deda.webp?x-oss-process=image/format,png)
![准备两个月,面试五分钟,Java中高级岗面试为何越来越难?](https://img-blog.csdnimg.cn/img_convert/5a4769af8db232d9dd0a75b07214f97f.webp?x-oss-process=image/format,png)
![准备两个月,面试五分钟,Java中高级岗面试为何越来越难?](https://img-blog.csdnimg.cn/img_convert/d582917585ca84c9855e7670bc8816f5.webp?x-oss-process=image/format,png)
> 由于篇幅限制小编,pdf文档的详解资料太全面,细节内容实在太多啦,所以只把部分知识点截图出来粗略的介绍,每个小节点里面都有更细化的内容!
eTc-1719262189266)]
[外链图片转存中...(img-nqBMWJuh-1719262189266)]
[外链图片转存中...(img-DET1hkvc-1719262189266)]
> 由于篇幅限制小编,pdf文档的详解资料太全面,细节内容实在太多啦,所以只把部分知识点截图出来粗略的介绍,每个小节点里面都有更细化的内容!