Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

oracle.javatools.parser.java.v2.model
Interface JavaFile

All Superinterfaces:
Element, JavaElement
All Known Subinterfaces:
SourceFile

public interface JavaFile
extends JavaElement

A compilation unit.


Field Summary
 
Fields inherited from interface oracle.javatools.parser.java.v2.model.JavaElement
EMPTY_ARRAY
 
Method Summary
 JavaClass getClass(java.lang.String name)
           
 java.util.Collection getClasses()
           
 JavaPackage getPackage()
           
 java.lang.String getPackageName()
           
 JavaClass getPrimaryClass()
          Here, "primary class" means the class that bears the same name as the compilation unit (file).
 java.net.URL getURL()
           
 
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaElement
getElementKind, getFile, getModifiers, getOwner, getSourceElement, isDeprecated, isFinal, isHidden, isSourceElement, isSynthetic, printCompiledInfo
 

Method Detail

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.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1.7.0)

E13403-08

Copyright © 1997, 2013, Oracle. All rights reserved.