Package helloworld.creational.factory_method

Source Code of helloworld.creational.factory_method.HelloWorldFactory

package helloworld.creational.factory_method;

import helloworld.HelloWorld;

/**
* <pre>
* Difference from abstract factory is the abstracting point:
* 1. Abstracting point of abstract factory is factory.
* 2. Abstracting point of factory method is generated object.
*
* </pre>
* @author yihua.huang@dianping.com
*/
public class HelloWorldFactory {

    public HelloWorld createHelloWorld(){
        return new HelloWorld() {
            @Override
            public String helloWorld() {
                return "Hello World!";
            }
        };
    }
}
TOP

Related Classes of helloworld.creational.factory_method.HelloWorldFactory

TOP
Copyright © 2018 www.massapi.com. 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.