KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jicengine > Instructions


1 package org.jicengine;
2 import java.util.Map JavaDoc;
3 import java.io.File JavaDoc;
4 import org.jicengine.io.Resource;
5
6 /**
7  * <p>
8  * The instructions given to a builder when it
9  * is asked to construct a graph of Java objects.
10  * </p>
11  *
12  * <p>
13  * The instructions consists of:
14  * </p>
15  * <ul>
16  * <li>The location of the <dfn>JIC file</dfn>, in form of a
17  * <code>org.jicengine.io.Resource</code> instance.</li>
18 * <li>The build-parameters, in form of a <code>java.util.Map</code>.</li>
19  *
20  * <p>
21  * Copyright (C) 2004 Timo Laitinen
22  * </p>
23  *
24  * @author Timo Laitinen
25  * @created 2004-09-20
26  * @since JICE-0.10
27  * @see org.jicengine.io.Resource
28  * @see org.jicengine.Builder
29  */

30
31 public class Instructions {
32
33     private Resource jicFile;
34     private Map JavaDoc parameters;
35
36     /**
37      * Creates an Instructions without parameters.
38      * @throws IllegalArgumentException if jicFile is null.
39      */

40     public Instructions(Resource jicFile)
41     {
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 JavaDoc parameters)
50     {
51         this.jicFile = jicFile;
52
53         if( jicFile == null ){
54             throw new IllegalArgumentException JavaDoc("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.unmodifiableMap(parameters);
60         }
61         else {
62             this.parameters = java.util.Collections.EMPTY_MAP;
63         }
64     }
65
66     public Resource getFile()
67     {
68         return this.jicFile;
69     }
70
71     /**
72      * @return may be null if there are no parameters.
73      */

74     public Map JavaDoc getParameters()
75     {
76         return this.parameters;
77     }
78 }
79
Popular Tags