Extension SDK

oracle.jdeveloper.jot
Interface JotImport

All Superinterfaces:
JotElement, JotFileElement

public interface JotImport
extends JotFileElement

The JotImport interface represents an import declaration in a Java source file. An import declaration must be in one of two forms: a single-type-import declaration (import java.io.File;) or a type-import-on-demand declaration (import java.util.*;). A single-type-import declaration imports a single type and makes it available by its simple name. A type-import-on-demand imports all the accessible types in a package as needed.

When resolving a simple type name to a fully qualified type name, all single-type-import declarations are checked, followed by the package containing the source file, followed by any type-import-on-demand imports. Note that the package java.lang is implicitly imported into source files; this is equivalent to each and every source file containing the declaration import java.lang.*.

Since:
5.0
See Also:
JotFile, "Section 7.5 of the Java Language Specification."

Method Summary
 java.lang.String getClassName()
          Retrieves the name portion of this import statment.
 java.lang.String getName()
          Retrieves the name contained in this import declaration.
 java.lang.String getPackage()
          Retrieves the package name portion of this import statment.
 boolean refersTo(java.lang.String thatIdent)
          Tests whether this import declaration and the supplied import text refer to the same class.
 void setClassName(java.lang.String clsName)
          sets the class name portion of this import statement.
 void setName(java.lang.String name)
          Sets the name contained in this import declaration.
 void setPackage(java.lang.String pkgName)
          Sets the package name portion of this import statement.
 
Methods inherited from interface oracle.jdeveloper.jot.JotElement
getElementName, getElementType, getEndOffset, getID, getJotWorkArea, getParent, getStartOffset, isExistent, isReadOnly, isStructureKnown, setParent
 

Method Detail

getName

public java.lang.String getName()
Retrieves the name contained in this import declaration. The name has the form package.class, where the class part of the name may be the "*" wildcard.

Returns:
the text of the import declaration, exluding the import keyword.
See Also:
getPackage(), getClassName()

setName

public void setName(java.lang.String name)
Sets the name contained in this import declaration. The name has the form package.class, where the class part of the name may be the "*" wildcard.

Parameters:
name - the package or class being imported.

getPackage

public java.lang.String getPackage()
Retrieves the package name portion of this import statment.

Returns:
the package name.
See Also:
getName()

setPackage

public void setPackage(java.lang.String pkgName)
Sets the package name portion of this import statement.

Parameters:
pkgName - the new package name.

getClassName

public java.lang.String getClassName()
Retrieves the name portion of this import statment.

Returns:
a class name or the "*" wildcard.
See Also:
getName()

setClassName

public void setClassName(java.lang.String clsName)
sets the class name portion of this import statement.

Parameters:
clsName - a class name for a narrow import or the "*" wildcard for a wide import.

refersTo

public boolean refersTo(java.lang.String thatIdent)
Tests whether this import declaration and the supplied import text refer to the same class. This is the case if the package parts are identical and the names parts are either identical, or one or both are "*".

Parameters:
thatIdent - the text of an import declaration.
Returns:
true if thatIdent matches this import declaration.

Extension SDK

 

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