/** {@inheritDoc} */ @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof CookieSetting)) { return false; } CookieSetting that = (CookieSetting) obj; return super.equals(obj) && this.maxAge == that.maxAge && this.secure == that.secure && Objects.equals(this.comment, that.comment); }
/** {@inheritDoc} */ @Override public boolean equals(Object obj) { boolean result = (obj == this); // if obj == this no need to go further if (!result) { // test for equality at Cookie level i.e. name and value. if (super.equals(obj)) { // if obj isn't a cookie setting or is null don't evaluate // further if (obj instanceof CookieSetting) { final CookieSetting that = (CookieSetting) obj; result = (this.maxAge == that.maxAge) && (this.secure == that.secure); if (result) // if "maxAge" and "secure" properties are equal // test comments { if (!(this.comment == null)) // compare comments // taking care of nulls { result = (this.comment.equals(that.comment)); } else { result = (that.comment == null); } } } } } return result; }
/** {@inheritDoc} */ @Override public boolean equals(Object obj) { boolean result = (obj == this); // if obj == this no need to go further if (!result) { // test for equality at Cookie level i.e. name and value. if (super.equals(obj)) { // if obj isn't a cookie setting or is null don't evaluate // further if (obj instanceof CookieSetting) { CookieSetting that = (CookieSetting) obj; result = (this.maxAge == that.maxAge) && (this.secure == that.secure); if (result) // if "maxAge" and "secure" properties are equal // test comments { if (!(this.comment == null)) // compare comments // taking care of nulls { result = (this.comment.equals(that.comment)); } else { result = (that.comment == null); } } } } } return result; }