affected, info 추가

master
mjkhan21 7 months ago
parent 2c1cde7f7d
commit fd59548218

@ -3,6 +3,7 @@ package cokr.xit.foundation.component;
import java.io.Serializable;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
/** .<br />
* .<br />
@ -12,11 +13,30 @@ import cokr.xit.foundation.AbstractComponent;
public class ServiceResponse extends AbstractComponent implements Serializable {
private static final long serialVersionUID = 1L;
private int affected;
private String
code,
message;
private Throwable throwable;
private DataObject info;
private Boolean success;
private RuntimeException throwable;
/** .
* @return
*/
public int getAffected() {
return affected;
}
/** .
* @param <T>
* @param affected
* @return
*/
public <T extends ServiceResponse> T setAffected(int affected) {
this.affected = affected;
return self();
}
/** .
* @return
@ -52,20 +72,28 @@ public class ServiceResponse extends AbstractComponent implements Serializable {
return self();
}
/** .
* @return
/** .
* @return
*/
public Throwable getThrowable() {
return throwable;
public DataObject getInfo() {
return info;
}
/** .
* @return
*/
public DataObject info() {
return ifEmpty(info, () -> info = new DataObject());
}
/** .
/** .
* @param <T>
* @param throwable
* @param key
* @param val
* @return
*/
public <T extends ServiceResponse> T setThrowable(Throwable throwable) {
this.throwable = throwable;
public <T extends ServiceResponse> T info(String key, Object val) {
info().put(key, val);
return self();
}
@ -90,4 +118,30 @@ public class ServiceResponse extends AbstractComponent implements Serializable {
this.success = success;
return self();
}
/** .
* @return
*/
public RuntimeException getThrowable() {
return throwable;
}
/** RuntimeException .
* @param <T>
* @param throwable
* @return
*/
public <T extends ServiceResponse> T setThrowable(Throwable throwable) {
this.throwable = runtimeException(throwable);
return self();
}
/** throw.
* @return false
*/
public boolean throwThrowable() {
if (throwable != null)
throw throwable;
return false;
}
}
Loading…
Cancel
Save