Package aQute.bnd.build
Class WorkspaceClassIndex
java.lang.Object
aQute.bnd.build.WorkspaceClassIndex
- All Implemented Interfaces:
AutoCloseable
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
addLongestMatchingPackagePrefix
(String packageName, List<org.osgi.resource.Capability> caps, BundleId bundle, MultiMap<BundleId, String> result) void
close()
private String
createFilter
(String packageName, String className) getMatchingResources
(String filter) private String
matchClassNameAgainstResource
(String binaryClassName, List<org.osgi.resource.Capability> caps, BundleId bundle, MultiMap<BundleId, String> result) Search for the bundles that export the given partialFqn.Search for the bundles that export the given class from the specified package.
-
Field Details
-
workspace
-
-
Constructor Details
-
WorkspaceClassIndex
WorkspaceClassIndex(Workspace workspace)
-
-
Method Details
-
search
Search for the bundles that export the given partialFqn. A partialFqn is either a package name, package prefix or a full FQN class name.The result is a map that has the full class name (FQN) as the key and a list of bundle ids as value.
This method uses a heuristic to split the FQN into its package and class portion - the first element that starts with a capital letter is taken to be the top-level class - everything after that is nested classes, everything before that is the package hierarchy. This method is pretty good for most cases, but not perfect. If your calling context has a more reliable way to split the FQN into the package and class name portions, you will get more accurate results by using the
search(String, String)
method.- Parameters:
partialFqn
- package and/or class name- Returns:
- a multimap of fqn|pack->bundleid
- Throws:
Exception
- See Also:
-
search
public Result<Map<String,List<BundleId>>> search(String packageName, String className) throws Exception Search for the bundles that export the given class from the specified package.The result is a map that has the full class name (FQN) as the key and a list of bundle ids as value.
- Parameters:
packageName
- the package in which to search for the matching class.className
- the name of the class to search for.- Returns:
- a multimap of fqn|pack->bundleid
- Throws:
Exception
- See Also:
-
matchClassNameAgainstResource
-
addLongestMatchingPackagePrefix
-
getMatchingResources
private Map<org.osgi.resource.Resource,List<org.osgi.resource.Capability>> getMatchingResources(String filter) throws Exception - Throws:
Exception
-
createFilter
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-