20 package net.sf.gridarta.model.archetype;
22 import java.util.LinkedHashMap;
24 import java.util.Map.Entry;
32 import org.jetbrains.annotations.NotNull;
33 import org.jetbrains.annotations.Nullable;
66 private final Map<String, String>
attributes =
new LinkedHashMap<>();
102 public void reInit(@NotNull
final String archetypeName) {
106 archetype.setArchetypeName(archetypeName);
113 throw new IllegalStateException(
"archetype is unset");
121 throw new IllegalStateException(
"archetype is unset");
128 throw new IllegalStateException(
"archetype is unset");
131 throw new IllegalStateException(
"error view collector is unset");
134 if (line.indexOf(
'\n') != -1) {
135 throw new IllegalArgumentException(
"line contains a NL character: '" + line +
"'");
139 final String key = tmp[0];
140 if (tmp.length < 2) {
142 final String archetypeName =
archetype.getArchetypeName();
147 final String value = tmp[1];
148 final String previousValue =
attributes.put(key, value);
149 if (previousValue !=
null) {
151 final String archetypeName =
archetype.getArchetypeName();
157 public void addLast(@NotNull
final G invObject) {
159 throw new IllegalStateException(
"archetype is unset");
176 throw new IllegalStateException(
"archetype is unset");
180 final StringBuilder sb =
new StringBuilder();
183 if (tmp.length == 2 && !
attributes.containsKey(tmp[0])) {
184 sb.append(attribute).append(
'\n');
187 for (
final Entry<String, String> attribute :
attributes.entrySet()) {
188 sb.append(attribute.getKey()).append(
' ').append(attribute.getValue()).append(
'\n');
190 result.setObjectText(sb.toString());
197 throw new IllegalStateException(
"archetype is unset");
204 throw new IllegalStateException(
"archetype is unset");
212 if (result ==
null) {
213 throw new IllegalStateException(
"archetype is unset");