站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

CompilationController (Java Source) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.java.source 0.13.0 1

org.netbeans.api.java.source
Class CompilationController

java.lang.Object
  extended by org.netbeans.api.java.source.CompilationInfo
      extended by org.netbeans.api.java.source.CompilationController
Direct Known Subclasses:
WorkingCopy

public class CompilationController
extends CompilationInfo

Class for explicit invocation of compilation phases on a java source. The implementation delegates to the CompilationInfo to get the data, the access to CompilationInfo is not synchronized, so the class isn't reentrant. XXX: make toPhase automatic in getTrees(), Trees.getElement, etc....


Method Summary
 ClasspathInfo getClasspathInfo()
           
 CompilationUnitTree getCompilationUnit()
          Returns the javac tree representing the source file.
 List<Diagnostic> getDiagnostics()
          Returns the errors in the file represented by the JavaSource.
 Document getDocument()
           
 Elements getElements()
           
 ElementUtilities getElementUtilities()
           
 FileObject getFileObject()
           
 JavaSource getJavaSource()
           
 JavaSource.Phase getPhase()
          Returns the current phase of the JavaSource.
 String getText()
          Returns the content of the file represented by the JavaSource.
 TokenHierarchy getTokenHierarchy()
           
 Trees getTrees()
           
 TreeUtilities getTreeUtilities()
           
 Types getTypes()
           
 TypeUtilities getTypeUtilities()
          Get the TypeUtilities.
 JavaSource.Phase toPhase(JavaSource.Phase phase)
          Moves the state to required phase.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toPhase

public JavaSource.Phase toPhase(JavaSource.Phase phase)
                         throws IOException
Moves the state to required phase. If given state was already reached the state is not changed. The method will throw exception if a state is illegal required. Acceptable parameters for thid method are
  • org.netbeans.api.java.source.JavaSource.Phase.PARSED
  • org.netbeans.api.java.source.JavaSource.Phase.ELEMENTS_RESOLVED
  • org.netbeans.api.java.source.JavaSource.Phase.RESOLVED
  • org.netbeans.api.java.source.JavaSource.Phase.UP_TO_DATE

    Parameters:
    phase - The required phase
    Returns:
    the reached state
    Throws:
    IllegalArgumentException - in case that given state can not be reached using this method
    IOException - when the file cannot be red

  • getPhase

    public JavaSource.Phase getPhase()
    Returns the current phase of the JavaSource.

    Overrides:
    getPhase in class CompilationInfo
    Returns:
    JavaSource.Phase the state which was reached by the JavaSource.

    getCompilationUnit

    public CompilationUnitTree getCompilationUnit()
    Returns the javac tree representing the source file.

    Overrides:
    getCompilationUnit in class CompilationInfo
    Returns:
    CompilationUnitTree the compilation unit cantaining the top level classes contained in the java source file. It may return null when the getPhase() is lower than JavaSource.Phase.PARSED. Before calling this method the client has to call toPhase(org.netbeans.api.java.source.JavaSource.Phase) with required JavaSource.Phase.

    getText

    public String getText()
    Returns the content of the file represented by the JavaSource.

    Overrides:
    getText in class CompilationInfo
    Returns:
    String the java source

    getTokenHierarchy

    public TokenHierarchy getTokenHierarchy()
    Overrides:
    getTokenHierarchy in class CompilationInfo

    getDiagnostics

    public List<Diagnostic> getDiagnostics()
    Returns the errors in the file represented by the JavaSource.

    Overrides:
    getDiagnostics in class CompilationInfo
    Returns:
    an list of Diagnostic

    getTrees

    public Trees getTrees()
    Overrides:
    getTrees in class CompilationInfo

    getTypes

    public Types getTypes()
    Overrides:
    getTypes in class CompilationInfo

    getElements

    public Elements getElements()
    Overrides:
    getElements in class CompilationInfo

    getJavaSource

    public JavaSource getJavaSource()
    Overrides:
    getJavaSource in class CompilationInfo

    getClasspathInfo

    public ClasspathInfo getClasspathInfo()
    Overrides:
    getClasspathInfo in class CompilationInfo

    getFileObject

    public FileObject getFileObject()
    Overrides:
    getFileObject in class CompilationInfo

    getDocument

    public Document getDocument()
                         throws IOException
    Overrides:
    getDocument in class CompilationInfo
    Throws:
    IOException

    getTreeUtilities

    public TreeUtilities getTreeUtilities()
    Overrides:
    getTreeUtilities in class CompilationInfo

    getElementUtilities

    public ElementUtilities getElementUtilities()
    Overrides:
    getElementUtilities in class CompilationInfo

    getTypeUtilities

    public TypeUtilities getTypeUtilities()
    Description copied from class: CompilationInfo
    Get the TypeUtilities.

    Overrides:
    getTypeUtilities in class CompilationInfo
    Returns:
    an instance of TypeUtilities

    org.netbeans.modules.java.source 0.13.0 1

    Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.