01: package org.jicengine;
02:
03: import java.util.Map;
04: import java.io.File;
05: import org.jicengine.io.Resource;
06:
07: /**
08: * <p>
09: * The instructions given to a builder when it
10: * is asked to construct a graph of Java objects.
11: * </p>
12: *
13: * <p>
14: * The instructions consists of:
15: * </p>
16: * <ul>
17: * <li>The location of the <dfn>JIC file</dfn>, in form of a
18: * <code>org.jicengine.io.Resource</code> instance.</li>
19: * <li>The build-parameters, in form of a <code>java.util.Map</code>.</li>
20: *
21: * <p>
22: * Copyright (C) 2004 Timo Laitinen
23: * </p>
24: *
25: * @author Timo Laitinen
26: * @created 2004-09-20
27: * @since JICE-0.10
28: * @see org.jicengine.io.Resource
29: * @see org.jicengine.Builder
30: */
31:
32: public class Instructions {
33:
34: private Resource jicFile;
35: private Map parameters;
36:
37: /**
38: * Creates an Instructions without parameters.
39: * @throws IllegalArgumentException if jicFile is null.
40: */
41: public Instructions(Resource jicFile) {
42: this (jicFile, null);
43: }
44:
45: /**
46: * @param parameters may be null, if there are no parameters.
47: * @throws IllegalArgumentException if jicFile is null.
48: */
49: public Instructions(Resource jicFile, Map parameters) {
50: this .jicFile = jicFile;
51:
52: if (jicFile == null) {
53: throw new IllegalArgumentException(
54: "JIC file null, can't create Instructions.");
55: }
56:
57: if (parameters != null) {
58: // modifying the parameters would lead into weird errors..
59: this .parameters = java.util.Collections
60: .unmodifiableMap(parameters);
61: } else {
62: this .parameters = java.util.Collections.EMPTY_MAP;
63: }
64: }
65:
66: public Resource getFile() {
67: return this .jicFile;
68: }
69:
70: /**
71: * @return may be null if there are no parameters.
72: */
73: public Map getParameters() {
74: return this.parameters;
75: }
76: }
|