Info.java :  » Search » ivy-facade » com » procippus » ivy » model » Java Open Source

Java Open Source » Search » ivy facade 
ivy facade » com » procippus » ivy » model » Info.java
package com.procippus.ivy.model;

import java.io.Serializable;

/**
 * Possibly the most import class, this represents the meat of
 * Ivy. Most critical attributes of a module are found here.
 * 
 * @author Procippus, LLC
 * @author Ryan McGuinness  <i>[ryan@procippus.com]</i>
 */
public class Info implements Comparable<Info>, Serializable {
  private static final long serialVersionUID = 6294884580423272431L;
  
  String organization;
  String module;
  String revision;
  String status; 
  String publication;
  
  //This is a sub element, but no reason to create an object
  String description;
  License license = new License();
  
  public Info() {}
  
  public Info(String organization, String module, String revision,
      String status, String publication) {
    super();
    this.organization = organization;
    this.module = module;
    this.revision = revision;
    this.status = status;
    this.publication = publication;
  }

  public String getOrganization() {
    return organization;
  }
  public void setOrganization(String organization) {
    this.organization = organization;
  }
  public String getModule() {
    return module;
  }
  public void setModule(String module) {
    this.module = module;
  }
  public String getRevision() {
    return revision;
  }
  public void setRevision(String revision) {
    this.revision = revision;
  }
  public String getStatus() {
    return status;
  }
  public void setStatus(String status) {
    this.status = status;
  }
  public String getPublication() {
    return publication;
  }
  public void setPublication(String publication) {
    this.publication = publication;
  }
  public String getDescription() {
    return description;
  }

  public void setDescription(String description) {
    this.description = description;
  }

  public License getLicense() {
    return license;
  }

  public void setLicense(License license) {
    this.license = license;
  }

  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + ((module == null) ? 0 : module.hashCode());
    result = prime * result
        + ((organization == null) ? 0 : organization.hashCode());
    result = prime * result
        + ((revision == null) ? 0 : revision.hashCode());
    return result;
  }
  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    Info other = (Info) obj;
    if (module == null) {
      if (other.module != null)
        return false;
    } else if (!module.equals(other.module))
      return false;
    if (organization == null) {
      if (other.organization != null)
        return false;
    } else if (!organization.equals(other.organization))
      return false;
    if (revision == null) {
      if (other.revision != null)
        return false;
    } else if (!revision.equals(other.revision))
      return false;
    return true;
  }
  @Override
  public String toString() {
    return organization + "/" + module + "/" + revision;
  }
  
  @Override
  public int compareTo(Info o) {
    return this.toString().compareTo(o.toString());
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.