Package helloworld.creational.builder

Source Code of helloworld.creational.builder.HelloWorldBuilder

package helloworld.creational.builder;

import helloworld.HelloWorld;
import helloworld.SplitHelloWorld;

/**
* @author yihua.huang@dianping.com
*/
public class HelloWorldBuilder {

    private String interjection;

    private String object;

    public static HelloWorldBuilder builder() {
        return new HelloWorldBuilder();
    }

    public HelloWorldBuilder interjection(String interjection) {
        this.interjection = interjection;
        return this;
    }

    public HelloWorldBuilder object(String object) {
        this.object = object;
        return this;
    }

    public HelloWorld getHelloWorld() {
        return new SplitHelloWorld(new SplitHelloWorld.HelloWorldInterjection() {
            @Override
            public String interjection() {
                return interjection;
            }
        }, new SplitHelloWorld.HelloWorldObject() {
            @Override
            public String object() {
                return object;
            }
        });
    }

}
TOP

Related Classes of helloworld.creational.builder.HelloWorldBuilder

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.