Code, JavaEE

Generic Result Type Definition

A neat way to unify returns and their types for API calls:


public interface Result<T> {
 public T getResult();
 public void setResult(T result);

 public Boolean isErrorCondition();
 public void setErrorCondition(Boolean errorCondition);

 public Map<String, Object> getResultMap();
 public void setResultMap(Map<String, Object> resultMap);
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s