1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 package br.com.ingenieux.mojo.beanstalk.cmd.env.swap;
23
24 public class SwapCNamesContextBuilder extends SwapCNamesContextBuilderBase<SwapCNamesContextBuilder> {
25
26 public SwapCNamesContextBuilder() {
27 super(new SwapCNamesContext());
28 }
29
30 public static SwapCNamesContextBuilder swapCNamesContext() {
31 return new SwapCNamesContextBuilder();
32 }
33
34 public SwapCNamesContext build() {
35 return getInstance();
36 }
37 }
38
39 class SwapCNamesContextBuilderBase<GeneratorT extends SwapCNamesContextBuilderBase<GeneratorT>> {
40
41 private SwapCNamesContext instance;
42
43 protected SwapCNamesContextBuilderBase(SwapCNamesContext aInstance) {
44 instance = aInstance;
45 }
46
47 protected SwapCNamesContext getInstance() {
48 return instance;
49 }
50
51 @SuppressWarnings("unchecked")
52 public GeneratorT withSourceEnvironmentName(String aValue) {
53 instance.setSourceEnvironmentName(aValue);
54
55 return (GeneratorT) this;
56 }
57
58 @SuppressWarnings("unchecked")
59 public GeneratorT withSourceEnvironmentId(String aValue) {
60 instance.setSourceEnvironmentId(aValue);
61
62 return (GeneratorT) this;
63 }
64
65 @SuppressWarnings("unchecked")
66 public GeneratorT withDestinationEnvironmentName(String aValue) {
67 instance.setDestinationEnvironmentName(aValue);
68
69 return (GeneratorT) this;
70 }
71
72 @SuppressWarnings("unchecked")
73 public GeneratorT withDestinationEnvironmentId(String aValue) {
74 instance.setDestinationEnvironmentId(aValue);
75
76 return (GeneratorT) this;
77 }
78 }