Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

javax.ide.model.java.source.tree
Interface FileT  view FileT download FileT.java

All Superinterfaces:
Tree

public interface FileT
extends Tree

The root of a source file, also called a compilation unit. From the root, a client may retrieve the package declaration, the import declarations, and all top-level type declarations.


Field Summary
 
Fields inherited from interface javax.ide.model.java.source.tree.Tree
EMPTY_ARRAY
 
Method Summary
 javax.ide.model.java.source.write.SingleTreeTransaction beginTransaction()
          Begins a single-tree transaction.
 void clearAllProperties(java.lang.String key)
          Traverses the entire parse tree, calling setProperty(key, null) on each element.
 java.util.List getClasses()
          Gets the list of top-level source classes.
 ClassT getClassT(java.lang.String name)
          Gets the matching top-level source class.
 javax.ide.model.java.source.write.TreeFactory getFactory()
          Gets the factory to create Tree objects in this FileT.
 java.util.Set getImportNames()
          Gets the set of import strings.
 java.util.List getImports()
          Gets the list of import declarations.
 javax.ide.model.java.JavaModel getOwningModel()
          Gets the owning JavaModel.
 PackageT getPackage()
          Gets the package declaration.
 java.lang.String getPackageName()
          Gets the package name, empty if none.
 ClassT getPrimaryClass()
          Gets the primary class.
 javax.ide.model.java.source.write.SingleTreeTransaction getTransaction()
          Gets the in-progress single-tree transaction, null if none.
 java.net.URI getURI()
          Gets the URI of this file, null if none.
 void setPackage(PackageT packageD)
          Attempts to set the package declaration.
 void setPackageName(java.lang.String packageName)
          Attempts to set the name of the package declaration.
 
Methods inherited from interface javax.ide.model.java.source.tree.Tree
accept, accept, addSelf, addSelf, addSelfAfter, addSelfBefore, clearProperty, cloneSelf, getChildren, getOwningFile, getParent, getPosition, getProperty, getSiblingAfter, getSiblingBefore, getSiblings, getTreeKind, isSynthetic, removeSelf, replaceSelf, setProperty
 

Method Detail

getPackage

public PackageT getPackage()
Gets the package declaration.


getPackageName

public java.lang.String getPackageName()
Gets the package name, empty if none.


setPackage

public void setPackage(PackageT packageD)
Attempts to set the package declaration.


setPackageName

public void setPackageName(java.lang.String packageName)
Attempts to set the name of the package declaration.


getImports

public java.util.List getImports()
Gets the list of import declarations.


getImportNames

public java.util.Set getImportNames()
Gets the set of import strings.


getClasses

public java.util.List getClasses()
Gets the list of top-level source classes.


getClassT

public ClassT getClassT(java.lang.String name)
Gets the matching top-level source class.


getPrimaryClass

public ClassT getPrimaryClass()
Gets the primary class. 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.


clearAllProperties

public void clearAllProperties(java.lang.String key)
Traverses the entire parse tree, calling setProperty(key, null) on each element.


getFactory

public javax.ide.model.java.source.write.TreeFactory getFactory()
Gets the factory to create Tree objects in this FileT.


getURI

public java.net.URI getURI()
Gets the URI of this file, null if none.


getOwningModel

public javax.ide.model.java.JavaModel getOwningModel()
Gets the owning JavaModel.


beginTransaction

public javax.ide.model.java.source.write.SingleTreeTransaction beginTransaction()
Begins a single-tree transaction.


getTransaction

public javax.ide.model.java.source.write.SingleTreeTransaction getTransaction()
Gets the in-progress single-tree transaction, null if none.

TODO: Should this be able to get the multi-tree transaction if one is open?