@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
接口类:
package com.jerry.design.facade.imp;
public interface FacadeImp {
public void test();
public void testA();
public void testB();
public void testC();
}
实现类A:
package com.jerry.design.facade.impl;
import com.jerry.design.facade.imp.FacadeImp;
public class TestA implements FacadeImp {
public void test(){
System.out.println(" i am TestA's test()!");
}
@Override
public void testA() {
System.out.println(" i am TestA's testA()!");
}
@Override
public void testB() {
}
@Override
public void testC() {
}
}
实现类B:
package com.jerry.design.facade.impl;
import com.jerry.design.facade.imp.FacadeImp;
public class TestB implements FacadeImp {
public void test(){
System.out.println(" i am TestB's test()!");
}
@Override
public void testA() {
}
@Override
public void testB() {
System.out.println(" i am TestB's testB()!");
}
@Override
public void testC() {
}
}
实现类C:
package com.jerry.design.facade.impl;
import com.jerry.design.facade.imp.FacadeImp;
public class TestC implements FacadeImp {
public void test(){
System.out.println(" i am TestC's test()!");
}
@Override
public void testA() {
}
@Override
public void testB() {
}
@Override
public void testC() {
System.out.println(" i am TestC's testC()!");
}
}
外观类:
package com.jerry.design.facade.impl;
public class Facade {
public void testFacadeImplA(){
new TestA().test();
new TestB().test();
new TestC().test();
}
public void testFacadeImplB(){
new TestA().testA();
new TestB().testB();
new TestC().testC();
}
}
调用代码:
package com.jerry.design.facade.client;
import com.jerry.design.facade.impl.Facade;
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
new Facade().testFacadeImplA();
// i am TestA's test()!
// i am TestB's test()!
// i am TestC's test()!
new Facade().testFacadeImplB();
// i am TestA's testA()!
// i am TestB's testB()!
// i am TestC's testC()!
}
}
总结:使子系统易用