|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.jdeveloper.java.JavaModel
public class JavaModel
The JavaModel
is an implementation of the JavaFileProvider
interface. It provides structured access to the contents of Java class and source files visible through a set of source and classpaths.
There is also access to a JavaClassLocator
instance for searching for the classes and subpackages contained in a package, and for finding an URL associated with a Java source or class file.
By default, the JavaFile and JavaClass (as well as SourceFile and SourceClass) instances retrieved through this API saved in a cache. Clients are encouraged to use the provided CacheSupport
API to provide indication as to when the cache is used, and when it is no longer in use (and can be flushed). Clients can also force a cache flush to occur.
Nested Class Summary | |
---|---|
protected class |
JavaModel.CacheTracker The CacheTracker just helps track where begin/end cache use calls are being made, and to ensure that they are matched properly. |
Field Summary | |
---|---|
protected CacheSupport |
_cacheSupport The cache support for this manager. |
protected JavaClassLocator |
_classLocator The class locator for this manager. |
protected CachedFileProvider |
_fileProvider The cached JavaFileProvider instance that does the real work. |
Constructor Summary | |
---|---|
protected |
JavaModel(CachedFileProvider provider) Protected constructor purposely. |
Method Summary | |
---|---|
SourceFile |
createSourceFile(java.net.URL sourceURL) Creates a new SourceFile for the given Java source URL (*.java). |
protected void |
finalize() In the finalizer for this JavaManager, hint to the underlying provider that it should perhaps clear its cache. |
JavaType |
getArrayType(JavaType javaType, int dimensions) Fetch the JavaType instance that will represent the given type and array dimensions. |
CacheSupport |
getCacheSupport() Fetch the CacheSupport instance for managing the cache use for this JavaManager instance. |
JavaClass |
getClass(java.lang.String fqName) Fetch the JavaClass instance for the given fully-qualified type name. |
JavaClass |
getClass(java.lang.String fqPrefix, java.lang.String name) Deprecated. use getClass(String) instead |
JavaClass |
getClassByVMName(java.lang.String fqVMName) Fetch the JavaClass instance for the given fully-qualified type name in VM notation. |
java.lang.ClassLoader |
getClassLoader() Fetch a ClassLoader instance that can load classes from the paths of this JavaManager instance. |
java.lang.ClassLoader |
getClassLoader(java.lang.ClassLoader parentLoader) Fetch a ClassLoader instance that can load classes from the paths of this JavaManager instance. |
JavaFile |
getFile(java.net.URL url) Fetch the JavaFile for the given URL. |
static JavaModel |
getInstance(URLPath sourcepath, URLPath classpath) Fetch a JavaManager instance for the given project. |
JavaClassLocator |
getJavaClassLocator() Fetch a JavaClassLocator instance for fetching package and class information. |
JavaPackage |
getPackage(java.lang.String fqName) Fetch the JavaPackage instance for the given fully-qualified package name. |
SourceClass |
getSourceClass(java.lang.String fqName) Fetch the SourceClass instance for the given fully-qualified class name. |
SourceFile |
getSourceFile(TextBuffer textBuffer) Creates a new SourceFile from the input TextBuffer but NOT tied any particular Java source URL. |
SourceFile |
getSourceFile(java.net.URL sourceURL) Fetch the SourceFile for the given Java source URL (*.java). |
TextBuffer |
getTextBuffer(java.net.URL url) Deprecated. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected CachedFileProvider _fileProvider
protected JavaClassLocator _classLocator
protected CacheSupport _cacheSupport
Constructor Detail |
---|
protected JavaModel(CachedFileProvider provider)
provider
- the provider that we wrapMethod Detail |
---|
public static JavaModel getInstance(URLPath sourcepath, URLPath classpath)
Note: Jdk paths are NOT implied. They must be explicitly included on sourcepath and classpath.
sourcepath
- An URLPath specifying the sourcepath.classpath
- An URLPath specifying the classpath.protected void finalize()
finalize
in class java.lang.Object
public java.lang.ClassLoader getClassLoader(java.lang.ClassLoader parentLoader)
parentLoader
- The ClassLoader to use as the parent. May be null.public java.lang.ClassLoader getClassLoader()
public JavaClassLocator getJavaClassLocator()
public CacheSupport getCacheSupport()
public JavaFile getFile(java.net.URL url)
getFile
in interface JavaFileProvider
url
- the URL to get the Java file forpublic SourceFile getSourceFile(java.net.URL sourceURL)
getSourceFile
in interface JavaFileProvider
sourceURL
- the source URL to get the Java file forpublic SourceFile createSourceFile(java.net.URL sourceURL) throws java.io.IOException, java.lang.IllegalArgumentException
createSourceFile
in interface JavaFileProvider
sourceURL
- the source URL to create a new Java file forjava.io.IOException
- if the new file cannot be createdjava.lang.IllegalArgumentException
- if the URL is not recognized as a Java source filepublic SourceFile getSourceFile(TextBuffer textBuffer)
getSourceFile
in interface JavaFileProvider
public JavaClass getClass(java.lang.String fqName)
getClass
in interface JavaProvider
fqName
- the fully-qualified name in dotted notation, such as "java.lang.Object" or "java.util.Map.Entry"
@Deprecated
public JavaClass getClass(java.lang.String fqPrefix,
java.lang.String name)
getClass(String)
insteadgetClass( String fqName )
above. This is scheduled for removal.getClass
in interface JavaProvider
fqPrefix
- the fully-qualified package prefixname
- the class namepublic JavaClass getClassByVMName(java.lang.String fqVMName)
getClassByVMName
in interface JavaProvider
fqVMName
- the fully-qualified type name in VM notation, such as "java/util/Map$Entry"public SourceClass getSourceClass(java.lang.String fqName)
getSourceClass
in interface JavaProvider
fqName
- the fully-qualified class name in dotted notation, such as "java.lang.Object" or "java.util.Map.Entry"public JavaType getArrayType(JavaType javaType, int dimensions)
getArrayType
in interface JavaProvider
javaType
- the JavaType instance to fetch an array type fordimensions
- the array dimensions to fetchjava.lang.IllegalArgumentException
- if dimensions is invalid (negative)public JavaPackage getPackage(java.lang.String fqName)
getPackage
in interface JavaProvider
fqName
- the fully-qualified package name, such as "java.io"
@Deprecated
public TextBuffer getTextBuffer(java.net.URL url)
getTextBuffer
in interface JavaProvider
url
- the URL to get the buffer for
|
Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference 11g Release 1 (11.1.1.7.2) E13403-10 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |