/* * Copyright LGPL3 * YES Technology Association * http://yestech.org * * http://www.opensource.org/licenses/lgpl-3.0.html */ package org.yestech.notify.objectmodel; import com.thoughtworks.xstream.annotations.XStreamAlias; import com.thoughtworks.xstream.annotations.XStreamAsAttribute; /** * A {@link Message} attachment that can be added. * */ @XStreamAlias("attachement") public class Attachment implements IAttachment { @XStreamAsAttribute private String fileName; public Attachment(String fileName) { this.fileName = fileName; } public String getFileName() { return fileName; } @Override public int hashCode() { return fileName != null ? fileName.hashCode() : 0; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Attachment)) return false; Attachment that = (Attachment) o; if (fileName != null ? !fileName.equals(that.fileName) : that.fileName != null) return false; return true; } public int compareTo(IAttachment o) { return fileName.compareTo(o.getFileName()); } }