View Javadoc
1   /*
2    * Copyright (c) 2016 ingenieux Labs
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  // CHECKSTYLE:OFF
18  
19  package br.com.ingenieux.mojo.beanstalk.cmd.dns;
20  
21  import com.amazonaws.services.elasticbeanstalk.model.EnvironmentDescription;
22  
23  import java.util.Collection;
24  
25  public class BindDomainsContextBuilder extends BindDomainsContextBuilderBase<BindDomainsContextBuilder> {
26  
27    public BindDomainsContextBuilder() {
28      super(new BindDomainsContext());
29    }
30  
31    public static BindDomainsContextBuilder createBindDomainsContext() {
32      return new BindDomainsContextBuilder();
33    }
34  
35    public BindDomainsContext build() {
36      return getInstance();
37    }
38  }
39  
40  class BindDomainsContextBuilderBase<GeneratorT extends BindDomainsContextBuilderBase<GeneratorT>> {
41  
42    private BindDomainsContext instance;
43  
44    protected BindDomainsContextBuilderBase(BindDomainsContext aInstance) {
45      instance = aInstance;
46    }
47  
48    protected BindDomainsContext getInstance() {
49      return instance;
50    }
51  
52    @SuppressWarnings("unchecked")
53    public GeneratorT withCurEnv(EnvironmentDescription env) {
54      instance.curEnv = env;
55  
56      return (GeneratorT) this;
57    }
58  
59    @SuppressWarnings("unchecked")
60    public GeneratorT withDomains(Collection<String> domains) {
61      instance.domains = domains;
62  
63      return (GeneratorT) this;
64    }
65  }