|
17 | 17 |
|
18 | 18 | import java.util.List; |
19 | 19 | import java.util.Set; |
20 | | -import java.util.function.Consumer; |
21 | 20 | import java.util.function.Function; |
22 | 21 |
|
23 | 22 | import app.packed.component.guest.OldContainerTemplateLink; |
@@ -70,73 +69,51 @@ public PackedContainerInstaller<?> newInstaller(Class<? extends Extension<?>> in |
70 | 69 | return installer; |
71 | 70 | } |
72 | 71 |
|
73 | | - |
74 | | - public static <H extends ContainerHandle<?>> PackedContainerTemplate<H> configure(PackedContainerTemplate<H> template, |
75 | | - Consumer<? super Configurator> configure) { |
76 | | - PackedContainerTemplateConfigurator<H> c = new PackedContainerTemplateConfigurator<>(template); |
77 | | - configure.accept(c); |
78 | | - return c.pbt; |
79 | | - } |
80 | | - |
81 | | - public final static class PackedContainerTemplateConfigurator<H extends ContainerHandle<?>> implements ContainerTemplate.Configurator { |
82 | | - |
83 | | - public PackedContainerTemplate<H> pbt; |
84 | | - |
85 | | - public PackedContainerTemplateConfigurator(PackedContainerTemplate<H> pbt) { |
86 | | - this.pbt = pbt; |
87 | | - } |
88 | | - |
89 | 72 | // /** {@inheritDoc} */ |
90 | 73 | // @Override |
91 | 74 | // public PackedContainerTemplateConfigurator carrierType(Class<?> guest) { |
92 | 75 | // // I don't think we are going to do any checks here? |
93 | 76 | // // Well not interface, annotation, abstract class, ... |
94 | 77 | // // All lifetime operation will change... |
95 | | -// this.pbt = new PackedContainerTemplate(pbt.kind, guest, pbt.links, pbt.resultType, pbt.componentTags, pbt.lifecycleKind); |
| 78 | +// this.pbt = new PackedContainerTemplate(kind, guest, links, resultType, componentTags, lifecycleKind); |
96 | 79 | // return this; |
97 | 80 | // } |
98 | 81 |
|
99 | | - // expects results. Maa ogsaa tage en Extension... |
100 | | - public PackedContainerTemplateConfigurator<H> expectResult(Class<?> resultType) { |
101 | | - this.pbt = new PackedContainerTemplate<>(pbt.kind, pbt.holderClass, pbt.links, resultType, pbt.componentTags, pbt.isManaged); |
102 | | - return this; |
103 | | - } |
| 82 | + // expects results. Maa ogsaa tage en Extension... |
| 83 | + public PackedContainerTemplate<H> expectResult(Class<?> resultType) { |
| 84 | + return new PackedContainerTemplate<>(kind, holderClass, links, resultType, componentTags, isManaged); |
| 85 | + } |
104 | 86 |
|
105 | | - /** {@inheritDoc} */ |
106 | | - @Override |
107 | | - public PackedContainerTemplateConfigurator<H> withLifetimeOperationAddContext(int index, ContextTemplate template) { |
108 | | - throw new UnsupportedOperationException(); |
109 | | - } |
| 87 | + /** {@inheritDoc} */ |
| 88 | + @Override |
| 89 | + public PackedContainerTemplate<H> withLifetimeOperationAddContext(int index, ContextTemplate template) { |
| 90 | + throw new UnsupportedOperationException(); |
| 91 | + } |
110 | 92 |
|
111 | | - public Wirelet wirelet() { |
112 | | - return null; |
113 | | - } |
| 93 | + public Wirelet wirelet() { |
| 94 | + return null; |
| 95 | + } |
114 | 96 |
|
115 | | - public PackedContainerTemplateConfigurator<H> withKind(PackedContainerKind kind) { |
116 | | - this.pbt = new PackedContainerTemplate<>(kind, pbt.holderClass, pbt.links, pbt.resultType, pbt.componentTags, pbt.isManaged); |
117 | | - return this; |
118 | | - } |
| 97 | + public PackedContainerTemplate<H> withKind(PackedContainerKind kind) { |
| 98 | + return new PackedContainerTemplate<>(kind, holderClass, links, resultType, componentTags, isManaged); |
| 99 | + } |
119 | 100 |
|
120 | | - /** {@inheritDoc} */ |
121 | | - @Override |
122 | | - public PackedContainerTemplateConfigurator<H> withPack(OldContainerTemplateLink channel) { |
123 | | - PackedContainerTemplatePackList tunnels = pbt.links.add((PackedContainerLink) channel); |
124 | | - this.pbt = new PackedContainerTemplate<>(pbt.kind, pbt.holderClass, tunnels, pbt.resultType, pbt.componentTags, pbt.isManaged); |
125 | | - return this; |
126 | | - } |
| 101 | + /** {@inheritDoc} */ |
| 102 | + @Override |
| 103 | + public PackedContainerTemplate<H> withPack(OldContainerTemplateLink channel) { |
| 104 | + PackedContainerTemplatePackList tunnels = links.add((PackedContainerLink) channel); |
| 105 | + return new PackedContainerTemplate<>(kind, holderClass, tunnels, resultType, componentTags, isManaged); |
| 106 | + } |
127 | 107 |
|
128 | | - public PackedContainerTemplateConfigurator<H> withWirelets(Wirelet... wirelets) { |
129 | | - throw new UnsupportedOperationException(); |
130 | | - } |
| 108 | + public PackedContainerTemplate<H> withWirelets(Wirelet... wirelets) { |
| 109 | + throw new UnsupportedOperationException(); |
| 110 | + } |
131 | 111 |
|
132 | | - /** {@inheritDoc} */ |
133 | | - @Override |
134 | | - public Configurator withComponentTag(String... tags) { |
135 | | - this.pbt = new PackedContainerTemplate<>(pbt.kind, pbt.holderClass, pbt.links, pbt.resultType, |
136 | | - ComponentTagHolder.copyAndAdd(pbt.componentTags, tags), pbt.isManaged); |
137 | | - return this; |
| 112 | + /** {@inheritDoc} */ |
| 113 | + @Override |
| 114 | + public PackedContainerTemplate<H> withComponentTag(String... tags) { |
| 115 | + return new PackedContainerTemplate<>(kind, holderClass, links, resultType, ComponentTagHolder.copyAndAdd(componentTags, tags), isManaged); |
138 | 116 |
|
139 | | - } |
140 | 117 | } |
141 | 118 |
|
142 | 119 | // |
|
0 commit comments