package com.shejimoshi.jiegouxingmoshi;
public interface Shap {
void draw();}
package com.shejimoshi.jiegouxingmoshi;
public class Cricle implements Shap{
@Override
public void draw(){
System.out.println("Circle::draw()");}}
package com.shejimoshi.jiegouxingmoshi;
public class Rectangle implements Shap{
@Override
public void draw(){
System.out.println("Rectangle:draw()");}}
package com.shejimoshi.jiegouxingmoshi;
public class Square implements Shap{
@Override
public void draw(){
System.out.println("Square:draw()");}}
package com.shejimoshi.jiegouxingmoshi;
public class ShapeMaker {
private Shap circle;
private Shap rectangle;
private Shap square;
public ShapeMaker(){
circle = new Cricle();
rectangle = new Rectangle();
square = new Square();}
public void drawCircle(){
circle.draw();}
public void drawRectangle(){
rectangle.draw();}
public void drawSquare(){
square.draw();}}
package com.shejimoshi.jiegouxingmoshi;
public class FacadePatternDemo {
public static void main(String[] args){
ShapeMaker shapeMaker = new ShapeMaker();
shapeMaker.drawCircle();
shapeMaker.drawRectangle();
shapeMaker.drawSquare();}}