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

E13403-04

javax.ide.model.java
Interface JavaModel

All Superinterfaces:
TreeLocator, TreeManager, TreeResolver

public interface JavaModel
extends TreeManager, TreeResolver, TreeLocator

The JavaModel is the central point of access to all source compilation unit facilities. Read and write access to parse trees is provided through the TreeManager interface. The ability to resolve source references to declarations is provided through the TreeResolver interface. The ability to fetch the source for a declaration is provided through the TreeLocator interface. Finally, declaration loading is provided through the JavaModel interface itself. A JavaModel will have an underlying classpath and sourcepath that define its search path.


Method Summary
 TypeD getArrayType(TypeD componentType, int dims)
          Fetches a TypeD for the given array type of the specified component type an dimensions.
 ClassD getClass(java.lang.String sourceName)
          Fetches a ClassD for the given fully qualified name in source format, null if none.
 PackageD getPackage(java.lang.String sourceName)
          Fetches a PackageD for the given fully-qualified name.
 TypeD getParameterizedType(TypeD baseType, TypeD[] arguments)
          Fetches a TypeD for the given parameterized type.
 
Methods inherited from interface javax.ide.model.java.source.TreeManager
cloneSourceFile, createSourceFile, getAnonymousFile, getSourceFile
 
Methods inherited from interface javax.ide.model.java.source.TreeResolver
getResolvedDeclaration, getResolvedType
 
Methods inherited from interface javax.ide.model.java.source.TreeLocator
getTree
 

Method Detail

getClass

ClassD getClass(java.lang.String sourceName)
Fetches a ClassD for the given fully qualified name in source format, null if none. The name may denote a primitive type, void return type, array type, or class type.

If multiple sources of class information are available, the most up-to-date one should be returned. For example, suppose we have both a class file C.class and a source file C.java that both provide class information for a class C. If C.class has a more recent timestamp than C.java, then a ClassD built from C.class should be returned.

Although implementations are not required to return the same instance each time, they are encouraged to do so as it will dramatically improve performance.

Note: ClassD's can be uniquely identified by their source names.

Parameters:
sourceName - The fully qualified name in source format, e.g. "java.lang.Object", "java.util.Map.Entry[]".
Returns:
A ClassD for the given fully qualified name, null if none can be found.
See Also:
TypeD.getQualifiedName()

getArrayType

TypeD getArrayType(TypeD componentType,
                   int dims)
Fetches a TypeD for the given array type of the specified component type an dimensions.

Parameters:
componentType - The array component type.
dims - The requested array dimension.
Returns:
A TypeD for the type requested. If dims is zero or componentType is null, then componentType is returned as is.
Throws:
java.lang.IllegalArgumentException - if dims < 0.

getParameterizedType

TypeD getParameterizedType(TypeD baseType,
                           TypeD[] arguments)
Fetches a TypeD for the given parameterized type.

Parameters:
baseType - The base type for this parameterized type.
arguments - Must be non-null.
Returns:
A TypeD for the indicated parameterized type. If the arguments are empty, the baseType is returned as is.
Throws:
java.lang.IllegalArgumentException - if baseType is not a generic type or if the arguments do not match the parameters.

getPackage

PackageD getPackage(java.lang.String sourceName)
Fetches a PackageD for the given fully-qualified name.

Although implementations are not required to return the same instance each time, they are encouraged to do so as it will dramatically improve performance.

Parameters:
sourceName - The fully qualified package name. "" for the root package.
Returns:
A PackageD for the requested package.

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

E13403-04

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