1
2
3
4
5 package org.state4j.sm.executors;
6
7 import java.util.Map;
8
9 import org.state4j.sm.SmContext;
10 import org.state4j.sm.SmExecutor;
11
12 public class SmSetContextAttributeExecutorImpl implements SmExecutor {
13 private Map<String, String> attributes;
14
15 public void execute(SmContext cntx) {
16 cntx.addAttributes(attributes);
17 }
18
19 public boolean hasAttributes() {
20 return attributes != null;
21 }
22
23 public Map<String, String> getAttributes() {
24 if (!hasAttributes()) {
25 throw new RuntimeException("this.attributes is null and can't be returned");
26 }
27 return this.attributes;
28 }
29
30 public void setAttributes(Map<String, String> attributes) {
31 this.attributes = attributes;
32 }
33 }