/** * {@inheritDoc} * * @see Object#hashCode() */ @Override public int hashCode() { final int prime = 31; int result = 1; String fileName = getFileName(); result = prime * result + ((fileName == null) ? 0 : fileName.hashCode()); result = prime * result + ((wikiPageReference == null) ? 0 : wikiPageReference.hashCode()); return result; }
/** * {@inheritDoc} * * @see Object#equals(Object) */ @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof AttachmentReference)) { return false; } AttachmentReference other = (AttachmentReference) obj; return StringUtils.areEqual(getFileName(), other.getFileName()) && wikiPageReference == null ? other.wikiPageReference == null : wikiPageReference.equals(other.wikiPageReference); }
/** * Creates a new typed reference to the specified attachment. * * @param fileName the file name * @param wikiPageReference a reference to the wiki page that holds the attachment */ public AttachmentReference(String fileName, WikiPageReference wikiPageReference) { this(wikiPageReference.getEntityReference().clone()); entityReference.setType(EntityType.ATTACHMENT); setFileName(fileName); }