KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > spoon > processing > Environment


1 package spoon.processing;
2
3 import java.io.FileNotFoundException JavaDoc;
4 import java.io.IOException JavaDoc;
5
6 import spoon.reflect.declaration.CtElement;
7
8 /**
9  * This interface represents the environment in which Spoon is launched -
10  * accessible through {@link spoon.reflect.Factory#getEnvironment()}. Its
11  * primary use is to report messages, warnings, and errors.
12  */

13 public interface Environment extends FactoryAccessor {
14
15     /**
16      * Gets the Java version compliance level.
17      */

18     public int getComplianceLevel();
19
20     /**
21      * Sets the Java version compliance level.
22      */

23     public void setComplianceLevel(int level);
24
25     /**
26      * This method should be called to print out a message with a source
27      * position link during the processing.
28      */

29     public void debugMessage(String JavaDoc message);
30
31     /**
32      * Returns the default file generator for this environment (gives the
33      * default output directory for the created files).
34      */

35     public FileGenerator<? extends CtElement> getDefaultFileGenerator();
36
37     /**
38      * Gets the processing manager.
39      */

40     ProcessingManager getManager();
41
42     /**
43      * Returns the properties for a given processor.
44      */

45     ProcessorProperties getProcessorProperties(String JavaDoc processorName)
46             throws FileNotFoundException JavaDoc, IOException JavaDoc;
47
48     /**
49      * Sets the properties for a given processor.
50      */

51     void setProcessorProperties(String JavaDoc processorName, ProcessorProperties prop);
52
53     /**
54      * Returns true if Spoon is in debug mode.
55      */

56     public boolean isDebug();
57
58     /**
59      * Tells if the processing is stopped, generally because one of the
60      * processors called {@link #setProcessingStopped(boolean)} after reporting
61      * an error.
62      */

63     public boolean isProcessingStopped();
64
65     /**
66      * Returns true if Spoon is in verbose mode.
67      */

68     public boolean isVerbose();
69
70     /**
71      * Helper method called by a processor to report an error, warning or
72      * message as dictated by the severity parameter. Note that this does not
73      * stop the processing or any remaing task. To do so, use
74      * {@link #setProcessingStopped(boolean)}.
75      *
76      * @param processor
77      * The processor that report this message. Can be null.
78      * @param severity
79      * The severity of the report
80      * @param element
81      * The CtElement to which the report is associated
82      * @param message
83      * The message to report
84      */

85     public void report(Processor processor, Severity severity,
86             CtElement element, String JavaDoc message);
87
88     /**
89      * Helper method called by a processor to report an error, warning or
90      * message as dictated by the severity parameter. Note that this does not
91      * stop the processing or any remaing task. To do so, use
92      * {@link #setProcessingStopped(boolean)}.
93      *
94      * @param processor
95      * The processor that report this message. Can be null.
96      * @param severity
97      * The severity of the report
98      * @param element
99      * The CtElement to which the report is associated
100      * @param message
101      * The message to report
102      * @param fixes
103      * The problem fixer(s) to correct this problem
104      */

105     public void report(Processor processor, Severity severity,
106             CtElement element, String JavaDoc message, ProblemFixer... fixes);
107
108     /**
109      * This method should be called to print out a message during the
110      * processing.
111      *
112      * @param processor
113      * The processor that report this message. Can be null.
114      * @param severity
115      * The severity of the report
116      * @param message
117      * The message to report
118      */

119     public void report(Processor processor, Severity severity, String JavaDoc message);
120
121     /**
122      * This method should be called to report the end of the processing.
123      */

124     public void reportEnd();
125
126     /**
127      * This method should be called to print out a progress message during the
128      * processing. On contrary to regular messages, progress messages are not
129      * meant to remain in the message logs and just indicate to the user some
130      * task progression information.
131      */

132     public void reportProgressMessage(String JavaDoc message);
133
134     /**
135      * Sets the debug mode.
136      */

137     public void setDebug(boolean debug);
138
139     /**
140      * Sets the default file generator for this environment.
141      */

142     void setDefaultFileGenerator(FileGenerator<? extends CtElement> generator);
143
144     /**
145      * Sets the processing manager of this environment.
146      */

147     void setManager(ProcessingManager manager);
148
149     /**
150      * This method can be called to stop the processing and all the remaining
151      * tasks. In general, a processor calls it after reporting a fatal error.
152      */

153     void setProcessingStopped(boolean processingStopped);
154
155     /**
156      * Sets/unsets the verbose mode.
157      */

158     void setVerbose(boolean verbose);
159 }
Popular Tags