Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.stitchgalaxy.domain; import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder; /** * * @author tarasev */ public class Partner implements Entity<Partner> { private Long id; private String name; private String uri; /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the uri */ public String getUri() { return uri; } /** * @param uri the uri to set */ public void setUri(String uri) { this.uri = uri; } /** * @return the id */ public Long getId() { return id; } /** * @param id the id to set */ public void setId(Long id) { this.id = id; } @Override public int hashCode() { return new HashCodeBuilder().append(name).append(uri).toHashCode(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null || this.getClass() != obj.getClass()) return false; Partner other = (Partner) obj; return sameIdentityAs(other); } public boolean sameIdentityAs(Partner other) { return other != null && new EqualsBuilder().append(this.name, other.name).append(this.uri, other.uri).isEquals(); } }