/** Creates a 200 Success status object. */ public static BatchStatus createSuccessStatus() { BatchStatus status = new BatchStatus(); status.setCode(HttpURLConnection.HTTP_OK); status.setReason("Success"); return status; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!sameClassAs(obj)) { return false; } BatchStatus other = (BatchStatus) obj; return eq(getCode(), other.getCode()) && eq(getContent(), other.getContent()) && eq(getContentType(), other.getContentType()) && eq(getReason(), other.getReason()); }
@Override public String toString() { return "{BatchStatus code=" + getAttributeValue(CODE) + " content=" + getTextValue() + " contentType=" + getAttributeValue(CONTENT_TYPE) + " reason=" + getAttributeValue(REASON) + "}"; } }
@Override public int hashCode() { int result = getClass().hashCode(); result = 37 * result + getCode(); if (getContent() != null) { result = 37 * result + getContent().hashCode(); } if (getContentType() != null) { result = 37 * result + getContentType().hashCode(); } if (getReason() != null) { result = 37 * result + getReason().hashCode(); } return result; }
/** * Returns the MIME type for the content of the error message contained in * this element. * * @return MIME type for the content of the error message contained in this * element */ public ContentType getContentType() { return getAttributeValue(CONTENT_TYPE); }
/** * Returns whether it has the error message explaining what went wrong while * processing the request. * * @return whether it has the error message explaining what went wrong while * processing the request */ public boolean hasContent() { return hasTextValue(); }
/** * Returns whether it has the HTTP response code. * * @return whether it has the HTTP response code */ public boolean hasCode() { return getCode() != 0; }
/** * Returns whether it has the MIME type for the content of the error message * contained in this element. * * @return whether it has the MIME type for the content of the error message * contained in this element */ public boolean hasContentType() { return getContentType() != null; }
/** * Returns whether it has the short message describing this status. * * @return whether it has the short message describing this status */ public boolean hasReason() { return getReason() != null; }
/** * Returns the error message explaining what went wrong while processing the * request. * * @return error message explaining what went wrong while processing the * request */ public String getContent() { return getTextValue(KEY); }
@Override public int hashCode() { int result = getClass().hashCode(); result = 37 * result + getCode(); if (getContent() != null) { result = 37 * result + getContent().hashCode(); } if (getContentType() != null) { result = 37 * result + getContentType().hashCode(); } if (getReason() != null) { result = 37 * result + getReason().hashCode(); } return result; }
/** * Returns the MIME type for the content of the error message contained in * this element. * * @return MIME type for the content of the error message contained in this * element */ public ContentType getContentType() { return getAttributeValue(CONTENT_TYPE); }
/** * Returns whether it has the error message explaining what went wrong while * processing the request. * * @return whether it has the error message explaining what went wrong while * processing the request */ public boolean hasContent() { return hasTextValue(); }
/** * Returns whether it has the HTTP response code. * * @return whether it has the HTTP response code */ public boolean hasCode() { return getCode() != 0; }
/** * Returns whether it has the MIME type for the content of the error message * contained in this element. * * @return whether it has the MIME type for the content of the error message * contained in this element */ public boolean hasContentType() { return getContentType() != null; }
/** * Returns whether it has the short message describing this status. * * @return whether it has the short message describing this status */ public boolean hasReason() { return getReason() != null; }
/** * Returns the error message explaining what went wrong while processing the * request. * * @return error message explaining what went wrong while processing the * request */ public String getContent() { return getTextValue(KEY); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!sameClassAs(obj)) { return false; } BatchStatus other = (BatchStatus) obj; return eq(getCode(), other.getCode()) && eq(getContent(), other.getContent()) && eq(getContentType(), other.getContentType()) && eq(getReason(), other.getReason()); }
/** Creates a Success status object. */ public static BatchStatus createCreatedStatus() { BatchStatus status = new BatchStatus(); status.setCode(HttpURLConnection.HTTP_CREATED); status.setReason("Created"); return status; }
@Override public int hashCode() { int result = getClass().hashCode(); result = 37 * result + getCode(); if (getContent() != null) { result = 37 * result + getContent().hashCode(); } if (getContentType() != null) { result = 37 * result + getContentType().hashCode(); } if (getReason() != null) { result = 37 * result + getReason().hashCode(); } return result; }