blob: 54ca2d0bbb6000f9c194886571b4b0b62c374cc1 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007 2008 IBM 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:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.equinox.internal.p2.update;
/*
* Represents a feature entry in a platform.xml file.
*/
public class Feature {
private String id;
private String url;
private String version;
private Site site;
public Feature(Site site) {
super();
if (site == null)
throw new IllegalArgumentException("Features should not have an empty site."); //$NON-NLS-1$
this.site = site;
}
public String getId() {
return id;
}
public Site getSite() {
return site;
}
public String getUrl() {
return url;
}
public String getVersion() {
return version;
}
public void setId(String id) {
this.id = id;
}
public void setUrl(String url) {
this.url = url;
}
public void setVersion(String version) {
this.version = version;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if (!(obj instanceof Feature))
return false;
Feature other = (Feature) obj;
if (!equals(getId(), other.getId()))
return false;
// shallow equals here. sites should never be null
if (!equals(getSite().getUrl(), other.getSite().getUrl()))
return false;
if (!equals(getUrl(), other.getUrl()))
return false;
if (!equals(getVersion(), other.getVersion()))
return false;
return true;
}
private boolean equals(Object one, Object two) {
return one == null ? two == null : one.equals(two);
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return super.hashCode();
}
}