All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fm.pattern.tokamak.sdk.commons.Result Maven / Gradle / Ivy

The newest version!
package fm.pattern.tokamak.sdk.commons;

import java.util.ArrayList;
import java.util.List;

public class Result {

	private T instance;
	private Integer responseCode;
	private List errors = new ArrayList();

	public static  Result accept(Integer responseCode, T instance) {
		return new Result(responseCode, instance, new ArrayList());
	}

	public static  Result reject(Integer responseCode, T instance, List errors) {
		return new Result(responseCode, instance, errors);
	}

	public Result() {

	}

	private Result(Integer responseCode, T instance, List errors) {
		this.responseCode = responseCode;
		this.instance = instance;
		this.errors.addAll(errors);
	}

	public T getInstance() {
		return instance;
	}

	public Integer getResponseCode() {
		return responseCode;
	}

	public List getErrors() {
		return errors;
	}

	public boolean accepted() {
		return getErrors().isEmpty();
	}

	public boolean rejected() {
		return !getErrors().isEmpty();
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy