blob: d53653568291fb84bb64010b77d634fad8df0d85 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2011 WindRiver Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* WindRiver Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.internal.p2.importexport;
import java.net.URI;
import java.util.List;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
public class IUDetail implements IAdaptable {
private final IInstallableUnit iu;
private final List<URI> referredRepo;
public IUDetail(IInstallableUnit iu, List<URI> uris) {
this.iu = iu;
referredRepo = uris;
}
public IInstallableUnit getIU() {
return iu;
}
public List<URI> getReferencedRepositories() {
return referredRepo;
}
// don't suppress this warning as it will cause build-time warning
// see bug 423628. This should be possible to fix once
// the entire hierarchy starts using generics
public Object getAdapter(Class adapter) {
if (IInstallableUnit.class.equals(adapter))
return iu;
return null;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj instanceof IUDetail) {
if (iu.equals(((IUDetail) obj).getIU()))
return true;
}
return false;
}
@Override
public int hashCode() {
return iu.hashCode();
}
}