| org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation
All known Subclasses: org.netbeans.modules.apisupport.project.queries.GlobalSourceForBinaryImpl, org.netbeans.modules.apisupport.project.queries.SourceForBinaryImpl,
SourceForBinaryQueryImplementation | public interface SourceForBinaryQueryImplementation (Code) | | Information about where Java sources corresponding to binaries
(classfiles) can be found.
A default implementation is registered by the
org.netbeans.modules.java.project module which looks up the
project corresponding to the file (if any; jar -protocol URLs
actually check the owner of the JAR file itself) and checks whether that
project has an implementation of this interface in its lookup. If so, it
delegates to that implementation. Therefore it is not generally necessary
for a project type provider to register its own global implementation of
this query, if it depends on the Java Project module and uses this style.
Note that if you supply a SourceForBinaryQueryImplementation
corresponding to an entry in a
org.netbeans.spi.java.classpath.ClassPathProvider for some source
files, there needs to be a
org.netbeans.spi.java.classpath.ClassPathProvider for the sources
used as dependencies as well. Otherwise code completion will not work well;
the current parser database creation strategy uses the following search order
when deciding what to parse for a binary classpath element:
- The sources returned by
SourceForBinaryQueryImplementation ,
if these have at least a bootclasspath specified as well by some
org.netbeans.spi.java.classpath.ClassPathProvider .
- Compiled classes mixed into the "source" directory, if there are any.
- Compiled classes in the binary classpath element.
See Also: org.netbeans.api.java.queries.SourceForBinaryQuery See Also: org.netbeans.api.queries.FileOwnerQuery See Also: org.netbeans.api.project.Project.getLookup since: org.netbeans.api.java/1 1.4 |
findSourceRoots | public SourceForBinaryQuery.Result findSourceRoots(URL binaryRoot)(Code) | | Returns the source root(s) for a given binary root.
The returned SourceForBinaryQuery.Result must be a singleton. It means that for
repeated calling of this method with the same recognized root the method has to
return the same instance of SourceForBinaryQuery.Result.
The typical implemantation of the findSourceRoots contains 3 steps:
- Look into the cache if there is already a result for the root, if so return it
- Check if the binaryRoot is recognized, if not return null
- Create a new SourceForBinaryQuery.Result for the binaryRoot, put it into the cache
and return it.
Any absolute URL may be used but typically it will use the file
protocol for directory entries and jar protocol for JAR entries
(e.g. jar:file:/tmp/foo.jar!/).
Parameters: binaryRoot - the class path root of Java class files a result object encapsulating the answer or null if the binaryRoot is not recognized |
|
|