Skip to content

Instantly share code, notes, and snippets.

@marianogonzalez
Created February 11, 2014 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marianogonzalez/8939788 to your computer and use it in GitHub Desktop.
Save marianogonzalez/8939788 to your computer and use it in GitHub Desktop.
/**
* This class represents an individual data piece in the context of a bulk operation
*/
public final class BulkItem<T> implements Serializable
{
/**
* The item id
*/
public Serializable getId();
/**
* Wether or not it was successful. Notice that this should be <code>false</code>
* if {@link #exception} is not <code>null</code>, however there might not be an
* exception but the item could still not be successful for other reasons.
*/
public boolean isSuccessful();
/**
* Message to add context on this item. Could be an error description, a warning
* or simply some info related to the operation
*/
public String getMessage();
/**
* An optional status code
*/
public String getStatusCode();
/**
* An exception if the item was failed
*/
public Exception getException();
/**
* The actual data this entity represents
*/
public T getPayload();
/**
* A custom property stored under the given key
*
* @param key the key of the custom property
* @return a {@link Serializable} value
*/
public Serializable getCustomProperty(String key);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment