add error response model

This commit is contained in:
Tienan Chen 2013-11-28 16:56:07 +08:00
parent 69c5f3527b
commit f7eb8db8b5
2 changed files with 54 additions and 6 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@
*.jar
*.war
*.ear
/target

View File

@ -0,0 +1,47 @@
package org.bench4q.share.models;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "error")
public class ErrorResponseModel {
private String code;
private String message;
private String resource;
@XmlElement
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
@XmlElement
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@XmlElement
public String getResource() {
return resource;
}
public void setResource(String resource) {
this.resource = resource;
}
public static ErrorResponseModel buildErrorResponse(String code, String message,
String resource) {
ErrorResponseModel errorResponse = new ErrorResponseModel();
errorResponse.setCode(code);
errorResponse.setMessage(message);
errorResponse.setResource(resource);
return errorResponse;
}
}