* @param reference The reference to resolve and/or find
* @param primary True if this reference is a primary reference
* @return The {@link IClassPackage} corresponding to the reference if it could be found/resolved, otherwise null
*/
public static IClassPackage get (IClassPackageResolver resolver, IClassPackageDependencyReference reference, boolean primary) {
ClassDependencyPoolImpl pool = new ClassDependencyPoolImpl("Lookup Temporary: " + reference);
append(pool, resolver, primary, reference);
for (
IClassPackageDescriptor desc = resolver.getImportableRepository().getDescriptor(resolver, reference);
desc != null && desc.getRelocation() != null;
desc = resolver.getImportableRepository().getDescriptor(resolver, reference)
) {
reference = new ClassPackageDependencyReferenceImpl(ClassPackageReferenceImpl.getRelocation(reference, desc.getRelocation()));
}
for (IClassPackage pkg : pool.getPackages(true)) {
if (pkg.compareTo(reference) == 0) return pkg;
}
return null;
}