KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > parser > ParseObjectRequest


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.java.parser;
21
22 import org.netbeans.modules.java.ElementFactory;
23 import java.io.IOException JavaDoc;
24 import java.io.InputStream JavaDoc;
25 import java.util.Collection JavaDoc;
26 import org.netbeans.api.java.classpath.ClassPath;
27
28 /** Request for parsing the Java source. This interface defines interactions
29     between the parsing engine and the request object.
30     Parser engine takes appropriate DataObject from the request and processes
31     its file. The engine consults the request about its validity from time to
32     time so it can stop time-consuming processing as soon as possible.
33     The main purpose is to inform the Request about states of processing so it
34     can properly track its validity.
35 *
36 * @author Petr Hamernik
37 */

38 public interface ParseObjectRequest {
39     /** Sets the number of syntax errors that occured during parsing.
40     */

41     public void setSyntaxErrors(int errors);
42     
43     /** Returns the number of syntax errors.
44     */

45     public int getSyntaxErrors();
46     
47     /**
48      * Sets number of semantic errors.
49      */

50     public void setSemanticErrors(int errors);
51     
52     /** Returns Element implementation creation factory. The Engine asks for the
53         factory after it finishes general text scan. The factory will be responsible
54         for creating the source text representation and to bind it to the request.
55     */

56     public ElementFactory getFactory();
57     
58     /**
59      * Called to obtain data to be parsed.
60      * @throws IOException if the data can't be returned.
61     */

62     public char[] getSource() throws IOException JavaDoc;
63
64     /**
65      * Returns a FileObject for up-to-date classfile that corresponds to the
66      * passed classname.
67      * The method ought to return null if the .class is out of date.
68      * @return FileObject containg .class for the given class name. The value can
69      * be null if the .class can't be found, is not up-to-date or the feature
70      * is not supported.
71      */

72     public InputStream JavaDoc findCompiledClass(String JavaDoc className);
73
74     /** Determines if the request is still valid.
75         In general, request processing stops whenever this method returns false.
76         It is <B>required</B> that implementation returns false, if the source contents
77         changes during request processing.
78         Implementation might return false whenever it decides to discard potential results
79         from this request to provide hint to the Parser Engine.
80     */

81     public boolean isValid();
82
83     public boolean needsProcessing();
84     
85     /** Notifies the request that the parser engine is about to process the request.
86         Should any data passed to the parser engine change after this call, the
87         parser request implementation should invalidate the request.
88     */

89     public void notifyStart();
90
91     /** Notifies the request object that the engine has finished its processing.
92         The request can then become completed (depending on its validity)
93     */

94     public void notifyComplete();
95     
96     public Object JavaDoc getParserType();
97  
98     /** @return the set of errors encountered while processing this
99      * request */

100     public Collection JavaDoc getMessages();
101    
102     public String JavaDoc getSourceName();
103     
104     public ClassPath getLibraryPath();
105     public ClassPath getBootClassPath();
106     public ClassPath getSourcePath();
107 }
108
Popular Tags