|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.0.0) E17493-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface SourceFile
The SourceFile represents the root node for a complete Source source file. Alternatively, a source file may be called a compilation unit. From the root, you may retrieve the package, the imports, and all top-level classes and interfaces. For .sqlj parses, you may optionally be able to retrieve a string representing the sql context.
Field Summary |
---|
Fields inherited from interface oracle.javatools.parser.java.v2.model.SourceElement |
---|
CHILDREN_ALL, CHILDREN_BLANKLINES, CHILDREN_COMMENTS, CHILDREN_default, CHILDREN_none, CHILDREN_REGULAR, EMPTY_ARRAY, PRINT_ALL, REFORMAT_ALL, REFORMAT_INDENT |
Method Summary | |
---|---|
void |
addSourceFileListener(SourceFileListener listener)
Registers the given observer to begin receiving notifications when changes are made on this SourceFile or when this SourceFile is invalidated. |
SourceTransaction |
beginTransaction()
Locks (and implicitly pins) the text buffer and indicates a new transaction. |
void |
cancelCompile()
Cancels the previously started compile() on this file. |
void |
clearAllBindings(int key)
Traverses the entire parse tree, calling clearBinding( key ) on each element. |
void |
clearCompiledInfo()
Clears the entire source data model of compiled information. |
SourceFile |
cloneSelf(TextBuffer textBuffer)
Clones this SourceFile into the input TextBuffer. |
void |
expire()
Mark this SourceFile as invalid. |
java.util.List<SourceError> |
getCompileErrors()
Gets the list of compile-time errors. |
SourceElement |
getElementAt(int offset)
Gets the most deeply nested SourceElement at the insertion point. |
SourceElement |
getElementAt(int offset,
int mask)
Gets the most deeply nested SourceElement at the insertion point. |
SourceElement |
getElementContaining(int startOffset,
int endOffset)
Gets the most deeply nested SourceElement that includes the range [startOffset, endOffset). |
java.util.Collection<SourceError> |
getErrors(int severity,
int errorCategory)
Gets all the errors in the indicated categories with the given severity or worse. |
SourceFactory |
getFactory()
Gets the SourceFactory tied to this SourceFile. |
int |
getLanguageVersion()
Gets the Java language version of this source file. |
java.lang.String |
getPackageName()
Gets the package name, empty if none. |
java.util.List<SourceError> |
getParseErrors()
Gets the list of parse-time errors. |
java.util.List<java.lang.String> |
getPossibleTypes()
Gets the list of possible type String's, collected during parse-time. |
SourcePreferences |
getPreferences()
Gets the saved JavaPreferences cookie. |
JavaProvider |
getProvider()
Gets the saved JavaProvider cookie. |
SourceClass |
getSourceClass(java.lang.String name)
Gets the matching top-level source class. |
java.util.List<SourceClass> |
getSourceClasses()
Gets the list of top-level source classes. |
java.util.Set<java.lang.String> |
getSourceImportNames()
Gets the set of import strings. |
java.util.List<SourceImport> |
getSourceImports()
Gets the list of import declarations. |
SourcePackage |
getSourcePackage()
Gets the package declaration. |
SourceClass |
getSourcePrimaryClass()
Gets the primary class. |
TextBuffer |
getTextBuffer()
Gets the associated TextBuffer. |
SourceTransaction |
getTransaction()
Gets the pending transaction, null if none. |
java.net.URL |
getURL()
Gets the saved URL cookie. |
boolean |
hasCompileErrors()
True if compiling generated any errors. |
boolean |
hasErrors(int severity,
int errorCategory)
True if any error in the indicated categories exists with the given severity or worse. |
boolean |
hasParseErrors()
True if parsing generated any errors. |
boolean |
isCompiled()
Note: This does not consider whether or not the file is out-of-date and needs to be recompiled. |
boolean |
isExpired()
True if this has been expired. |
void |
pinTextBuffer(TextBuffer textBuffer)
Sets the text buffer cookie and pins it. |
void |
removeSourceFileListener(SourceFileListener listener)
Unregisters the given observer. |
void |
setPackageName(java.lang.String packageName)
Attempts to set the name of the package declaration. |
void |
setPreferences(SourcePreferences preferences)
Sets the preferences to be used with this source file. |
void |
setProvider(JavaProvider provider)
Sets the provider cookie that will provide class information needed for compilation. |
void |
setSourcePackage(SourcePackage packageD)
Attempts to set the package declaration. |
void |
setTextBuffer(TextBuffer textBuffer)
Sets the text buffer but leaves it unpinned. |
void |
setURL(java.net.URL url)
Set the URL cookie that is saved with this SourceFile. |
void |
unpinTextBuffer()
Unpins the saved text buffer from this parse tree. |
Methods inherited from interface oracle.javatools.parser.java.v2.model.SourceElement |
---|
addSelf, addSelf, addSelfAfter, addSelfBefore, adjustTextIndentation, clearBinding, cloneSelf, compile, getBinding, getChildren, getChildren, getCompiledObject, getContainedElements, getEndOffset, getOwningFile, getOwningSourceFile, getParent, getSiblingAfter, getSiblingBefore, getSiblings, getSiblings, getStartOffset, getSymbolKind, getText, hasErrors, print, print, reformatSelf, removeSelf, replaceSelf, resolve, setBinding, setContext, visitSelf |
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaFile |
---|
getClass, getClasses, getPackage, getPrimaryClass |
Methods inherited from interface oracle.javatools.parser.java.v2.model.JavaElement |
---|
getElementKind, getFile, getModifiers, getOwner, getSourceElement, isDeprecated, isFinal, isHidden, isSourceElement, isSynthetic, printCompiledInfo |
Method Detail |
---|
int getLanguageVersion()
JavaTokens
.J2SE_*
constant indicating
J2SE_13
(and earlier),
J2SE_14
,
J2SE_15
, or
J2SE_16
.SourcePackage getSourcePackage()
java.lang.String getPackageName()
getPackageName
in interface JavaFile
void setSourcePackage(SourcePackage packageD)
void setPackageName(java.lang.String packageName)
packageName
- Must be non-null. If empty, this will attempt to
remove the package declaration.java.util.List<SourceImport> getSourceImports()
java.util.Set<java.lang.String> getSourceImportNames()
java.util.List<SourceClass> getSourceClasses()
SourceClass getSourceClass(java.lang.String name)
SourceClass getSourcePrimaryClass()
SourceFile cloneSelf(TextBuffer textBuffer)
textBuffer
- If null, an array text buffer is created for use.
java.lang.UnsupportedOperationException
- if this SourceFile has no
TextBuffer associated with it.
java.lang.UnsupportedOperationException
- if this SourceFile has an
open transaction with outstanding changes. To clone a SourceFile
with an open transaction, perform a savepoint() on the
transaction.SourceFactory getFactory()
void clearAllBindings(int key)
java.util.List<java.lang.String> getPossibleTypes()
void cancelCompile()
void clearCompiledInfo()
boolean isCompiled()
void expire()
boolean isExpired()
boolean hasParseErrors()
java.util.List<SourceError> getParseErrors()
boolean hasCompileErrors()
java.util.List<SourceError> getCompileErrors()
boolean hasErrors(int severity, int errorCategory)
severity
- Valid values are JavaErrors.SEVERITY_*.errorCategory
- Valid values are JavaErrors.ERROR_CATEGORY_*.
If no error categories are included, the
error set is trivially empty.
If ERROR_CATEGORY_COMPILE is included, this
SourceFile will be implicitly compiled if
if not already so.java.util.Collection<SourceError> getErrors(int severity, int errorCategory)
severity
- Valid values are JavaErrors.SEVERITY_*.errorCategory
- Valid values are JavaErrors.ERROR_CATEGORY_*.
If no error categories are included, the
error set is trivially empty.
If ERROR_CATEGORY_COMPILE is included, this
SourceFile will be implicitly compiled if
if not already so.java.net.URL getURL()
getURL
in interface JavaFile
void setURL(java.net.URL url)
JavaProvider getProvider()
ExpiredTextBufferException
- if this SourceFile is out-of-date because the underlying
TextBuffer was modifiedvoid setProvider(JavaProvider provider)
SourcePreferences getPreferences()
void setPreferences(SourcePreferences preferences)
TextBuffer getTextBuffer()
ExpiredTextBufferException
- if this SourceFile is out-of-date because the underlying
TextBuffer was modifiedvoid setTextBuffer(TextBuffer textBuffer)
java.lang.IllegalStateException
- if there is already a pinned text
buffer.void pinTextBuffer(TextBuffer textBuffer)
java.lang.IllegalStateException
- if there is already a pinned text
buffer.void unpinTextBuffer()
SourceTransaction beginTransaction()
java.lang.UnsupportedOperationException
- if there is no text buffer to
edit.
java.lang.IllegalStateException
- if there is already a transaction
in progress.
ExpiredTextBufferException
- if this SourceFile is out-of-date because the underlying
TextBuffer was modifiedSourceTransaction getTransaction()
void addSourceFileListener(SourceFileListener listener)
listener
- The listener to be added.void removeSourceFileListener(SourceFileListener listener)
listener
- The listener to be removed.SourceElement getElementAt(int offset)
- If element A is a child (or descendant) of element B, then A is returned. - Otherwise, the element occurring after the insertion point is returned.
offset
- The insertion point.
SourceElement getElementAt(int offset, int mask)
0. Whitespace. 1. Comments. 2. All others.If there are two elements at the insertion point (one before and one after), then:
1. If they have different precedence, the one with the higher precedence is returned. For example, suppose one element is a whitespace element (0) and the other is a structural element (2), then the structural element is returned. 2. The element occurring after the insertion point is returned.
offset
- The insertion point.mask
- Same as the mask in getChildren(I) or getSiblings(I).
SourceElement.getChildren(int)
,
SourceElement.getSiblings(int)
SourceElement getElementContaining(int startOffset, int endOffset)
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK 11g Release 2 (11.1.2.0.0) E17493-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |