first commit
This commit is contained in:
36
src/be/jeffcheasey88/todo/model/Result.java
Normal file
36
src/be/jeffcheasey88/todo/model/Result.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package be.jeffcheasey88.todo.model;
|
||||
|
||||
import dev.peerat.framework.utils.json.JsonMap;
|
||||
|
||||
public class Result<E>{
|
||||
|
||||
private E element;
|
||||
private int errorCode;
|
||||
private JsonMap error;
|
||||
|
||||
public Result(E element){
|
||||
this.element = element;
|
||||
}
|
||||
|
||||
public Result(int errorCode, JsonMap error){
|
||||
this.errorCode = errorCode;
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public boolean success(){
|
||||
return error == null;
|
||||
}
|
||||
|
||||
public E getElement(){
|
||||
return this.element;
|
||||
}
|
||||
|
||||
public int getErrorCode(){
|
||||
return this.errorCode;
|
||||
}
|
||||
|
||||
public JsonMap getError(){
|
||||
return this.error;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user