Package com.alibaba.demo.cooma.car

Examples of com.alibaba.demo.cooma.car.Car


    public static void main(String[] args) {
        ExtensionLoader<Car> extensionLoader = ExtensionLoader.getExtensionLoader(Car.class);

        // 演示 扩展的获得、关联扩展点的注入(Car扩展点引用了Wheel)

        Car defaultCar = extensionLoader.getDefaultExtension();
        defaultCar.run();

        System.out.println("=================================");

        Car car1 = extensionLoader.getExtension("racing");
        car1.run();

        System.out.println("=================================");

        Car car2 = extensionLoader.getExtension("sport", Utils.kv2Map(Wheel.class.getName(), "wood"));
        car2.run(); // 缺省使用RubberWheel

        System.out.println("=================================");

        Car car3 = extensionLoader.getExtension(Utils.kv2Map(Car.class.getName(), "racing", Wheel.class.getName(), "wood"));
        car3.run(); // 缺省使用RubberWheel

        // 演示 Wrapper的使用

        System.out.println("=================================");

        Car countedSportCar1 = extensionLoader.getExtension("sport", Arrays.asList("run_counter"));
        Car countedSportCar2 = extensionLoader.getExtension("sport", Arrays.asList("run_counter"));

        countedSportCar1.run();
        countedSportCar2.run();
        countedSportCar1.run();
    }
View Full Code Here

TOP

Related Classes of com.alibaba.demo.cooma.car.Car

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.