短视频带货app开发,java外观模式Facade
短视频带货app开发,java外观模式Facade实现的相关代码
外观类代码
handlebars public class ShapeMaker { private Shape circle; private Shape rectangle; private Shape square; public ShapeMaker() { circle = new Circle(); rectangle = new Rectangle(); square = new Square(); } public void drawCircle(){ circle.draw(); } public void drawRectangle(){ rectangle.draw(); } public void drawSquare(){ square.draw(); } }
使用外观类
handlebars public class FacadePatternDemo { public static void main(String[] args) { ShapeMaker shapeMaker = new ShapeMaker(); shapeMaker.drawCircle(); shapeMaker.drawRectangle(); shapeMaker.drawSquare(); } }
以上就是短视频带货app开发,java外观模式Facade实现的相关代码, 更多内容欢迎关注之后的文章