~fredericp/zaluum/rt

« back to all changes in this revision

Viewing changes to org.zaluum.model/src/org/zaluum/model/basicbox/InstanceBox.java

  • Committer: Frederic Perez Ordeig
  • Date: 2010-04-07 07:55:38 UTC
  • mfrom: (308.1.63 wip-scala)
  • Revision ID: frederic@zaluum.com-20100407075538-muaneuoz134fqu5o
merged

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import java.util.Map;
23
23
 
24
24
import org.zaluum.model.Box;
25
 
import org.zaluum.model.OpenBox;
26
25
import org.zaluum.model.annotation.PropertyAnnotation;
27
26
 
28
27
import com.google.common.base.Preconditions;
32
31
 * @author frede
33
32
 *
34
33
 */
35
 
public class InstanceBox extends OpenBox {
36
 
        private static final long serialVersionUID = 1L;
 
34
public class InstanceBox extends Box<InstanceBox> {
37
35
        private String linkedBoxName="";
38
 
        private transient Map<String,Object> parameters;
39
 
        
 
36
        private Map<String,Object> parameters;
40
37
        public InstanceBox() {
41
38
                setName("instance");
42
39
        }
43
 
        public InstanceBox(InstanceBox c){
44
 
                super(c);
45
 
                linkedBoxName = c.linkedBoxName;
46
 
                parameters = c.parameters!=null?Maps.newHashMap(c.parameters):null;
47
 
        }
48
 
        public String getLinkedBoxName() {
49
 
                return linkedBoxName;
50
 
        }
 
40
        
 
41
        public InstanceBox(InstanceBox instanceBox) {
 
42
                super(instanceBox);
 
43
                linkedBoxName = instanceBox.linkedBoxName;
 
44
        }
 
45
 
51
46
        @PropertyAnnotation(name="Linked Box Name", comment="Name of the box to instantiate")
52
47
        public void setLinkedBoxName(String linkedBoxName) {
53
 
                Preconditions.checkNotNull(linkedBoxName);
54
48
                this.linkedBoxName = linkedBoxName;
55
 
                observable.notifyObservers();
 
49
                notifyObservers();
56
50
        }
57
 
        @Override
58
 
        public Box deepCopy() {
59
 
                return new InstanceBox(this);
 
51
        public String getLinkedBoxName() {
 
52
                return linkedBoxName;
60
53
        }
61
54
        public void setParameters(Map<String, Object> parameters) {
62
55
                Preconditions.checkNotNull(parameters);
67
60
                        parameters = Maps.newHashMap();
68
61
                return parameters;
69
62
        }
 
63
 
 
64
        @Override
 
65
        public InstanceBox copy() {
 
66
                return new InstanceBox(this);
 
67
        }
 
68
 
70
69
        @Override
71
70
        public String getResourceKey() {
72
71
                return "instance";
73
72
        }
74
 
 
75
73
}