|
org.netbeans.modules.java.source 0.13.0 1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.netbeans.api.java.source.SourceUtils
public class SourceUtils
Method Summary | |
---|---|
static CompilationUnitTree |
addImports(CompilationUnitTree cut,
List<String> toImport,
TreeMaker make)
|
static boolean |
checkTypesAssignable(CompilationInfo info,
TypeMirror from,
TypeMirror to)
|
static TypeMirror |
getBound(WildcardType wildcardType)
|
static Set<URL> |
getDependentRoots(URL root)
Returns the dependent source path roots for given source root. |
static TypeElement |
getEnclosingTypeElement(Element element)
Returns the type element within which this member or constructor is declared. |
static FileObject |
getFile(Element element)
Returns a FileObject in which the Element is defined. |
static FileObject |
getFile(Element element,
ClasspathInfo cpInfo)
Returns a FileObject in which the Element is defined. |
static FileObject |
getFile(ElementHandle<? extends Element> handle,
ClasspathInfo cpInfo)
Returns a FileObject of the source file in which the handle is declared. |
static Element |
getImplementationOf(CompilationInfo info,
ExecutableElement method,
TypeElement origin)
|
static URL |
getJavadoc(Element element,
ClasspathInfo cpInfo)
Finds URL of a javadoc page for given element when available. |
static Collection<ElementHandle<TypeElement>> |
getMainClasses(FileObject fo)
Returns classes declared in the given source file which have the main method. |
static Collection<ElementHandle<TypeElement>> |
getMainClasses(FileObject[] sourceRoots)
Returns classes declared under the given source roots which have the main method. |
static TypeElement |
getOutermostEnclosingTypeElement(Element element)
|
static boolean |
isMainClass(String qualifiedName,
ClasspathInfo cpInfo)
Returns true when the class contains main method. |
static boolean |
isMainMethod(ExecutableElement method)
Returns true if the method is a main method |
static boolean |
isScanInProgress()
Tests whether the initial scan is in progress. |
static TreePath |
pathFor(CompilationInfo info,
Element element)
Deprecated. Use Trees.getPath(Element) instead. |
static String |
resolveImport(CompilationInfo info,
TreePath context,
String fqn)
Resolve full qualified name in the given context. |
static Tree |
treeFor(CompilationInfo info,
Element element)
Deprecated. Use Trees.getTree(Element) instead. |
static void |
waitScanFinished()
Waits for the end of the initial scan, this helper method is designed for tests which require to wait for end of initial scan. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static Tree treeFor(CompilationInfo info, Element element)
Trees.getTree(Element)
instead.
public static TreePath pathFor(CompilationInfo info, Element element)
Trees.getPath(Element)
instead.
public static Element getImplementationOf(CompilationInfo info, ExecutableElement method, TypeElement origin)
public static boolean checkTypesAssignable(CompilationInfo info, TypeMirror from, TypeMirror to)
public static TypeMirror getBound(WildcardType wildcardType)
public static TypeElement getEnclosingTypeElement(Element element) throws IllegalArgumentException
IllegalArgumentException
- if the provided element is a package elementpublic static TypeElement getOutermostEnclosingTypeElement(Element element)
public static String resolveImport(CompilationInfo info, TreePath context, String fqn) throws NullPointerException, IOException
info
passed to this method is not an instance of WorkingCopy
,
missing import statement is added from a separate modification task executed asynchronously.
info
- CompilationInfo over which the method should workcontext
- in which the fully qualified should be resolvedfqn
- the fully qualified name to resolve
NullPointerException
IOException
public static CompilationUnitTree addImports(CompilationUnitTree cut, List<String> toImport, TreeMaker make) throws IOException
IOException
public static FileObject getFile(Element element)
FileObject
in which the Element is defined.
Element must be defined in source file
element
- for which the FileObject
should be located
FileObject
or null if it cannot be
found in any source file.public static FileObject getFile(Element element, ClasspathInfo cpInfo)
FileObject
in which the Element is defined.
element
- for which the FileObject
should be locatedcpInfo
- the classpaths context
FileObject
or null if it cannot be
foundpublic static FileObject getFile(ElementHandle<? extends Element> handle, ClasspathInfo cpInfo)
FileObject
of the source file in which the handle is declared.
handle
- to find the FileObject
forcpInfo
- classpaths for resolving handle
FileObject
or null when the source file cannot be foundpublic static URL getJavadoc(Element element, ClasspathInfo cpInfo)
URL
of a javadoc page for given element when available. This method
uses JavadocForBinaryQuery
to find the javadoc page for the give element.
For PackageElement
it returns the package-summary.html for given package.
element
- to find the Javadoc forcpInfo
- classpaths used to resolve
public static boolean isScanInProgress()
public static void waitScanFinished() throws InterruptedException
InterruptedException
- is thrown when the waiting thread is interrupted.public static Set<URL> getDependentRoots(URL root)
public static Collection<ElementHandle<TypeElement>> getMainClasses(FileObject fo)
fo
- source file
IllegalArgumentException
- when file does not exist or is not a java source file.public static boolean isMainClass(String qualifiedName, ClasspathInfo cpInfo)
qualifiedName
- the fully qualified name of classcpInfo
- the classpath used to resolve the class
public static boolean isMainMethod(ExecutableElement method)
method
- to be checked
public static Collection<ElementHandle<TypeElement>> getMainClasses(FileObject[] sourceRoots)
sourceRoots
- the source roots
|
org.netbeans.modules.java.source 0.13.0 1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |