What this is
This file is included in the DevDaily.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn
Java by Example" TM.
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package org.netbeans.spi.java.queries;
import java.net.URL;
import org.netbeans.api.java.queries.SourceForBinaryQuery;
import org.openide.filesystems.FileObject;
// XXX add a listener to changes in result
/**
* 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 {@link org.netbeans.spi.java.classpath.ClassPathProvider} for some source
* files, there needs to be a {@link 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
* {@link 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 org.netbeans.api.java.queries.SourceForBinaryQuery
* @see org.netbeans.api.queries.FileOwnerQuery
* @see org.netbeans.api.project.Project#getLookup
* @since org.netbeans.api.java/1 1.4
*/
public interface SourceForBinaryQueryImplementation {
/**
* Returns the source root(s) for a given binary root.
*
* 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!/).
*
* @param binaryRoot the class path root of Java class files
* @return a result object encapsulating the answer or null if the binaryRoot is not recognized
*/
public SourceForBinaryQuery.Result findSourceRoots(URL binaryRoot);
}
|