Skip navigation links
oracle.javatools.parser.java.v2.model
Interface JavaFile
- All Superinterfaces:
- Element, JavaElement
- All Known Subinterfaces:
- SourceFile
-
public interface JavaFile
- extends JavaElement
A compilation unit.
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaElement |
getElementKind, getFile, getModifiers, getOwner, getSourceElement, isDeprecated, isFinal, isHidden, isSourceElement, isSynthetic, printCompiledInfo |
getPackage
JavaPackage getPackage()
-
- Returns:
- The name of the package declaration. The root package, if none. Null if a package factory couldn't be found (that's usually bad).
getPackageName
java.lang.String getPackageName()
-
- Returns:
- The name of the owning package. An empty string, if none.
getClasses
java.util.Collection getClasses()
-
- Returns:
- The array of classes declared in this compilation unit. Returns a collection of JavaClass's.
getClass
JavaClass getClass(java.lang.String name)
-
- Returns:
- The matching class. Null if none.
getPrimaryClass
JavaClass getPrimaryClass()
- Here, "primary class" means the class that bears the same name as the compilation unit (file). If no class is defined with the same name as the compilation unit, then no class will be returned. If the compilation unit has no name, then the first class is returned.
The term "primary class" is not actually used in any reference I tried: JLS, JPL, or Effective Java. It does see some usage on the web. The term "main class" could be confused with the run-time class whose "main(...)" method is being run.
-
- Returns:
- The primary class defined by this source file. Null if none.
getURL
java.net.URL getURL()
-
- Returns:
- The URL this class was constructed with. Null if none.
Skip navigation links
Copyright © 1997, 2011, Oracle. All rights reserved.