package com.spiddekauga.android.util;

/**
 * Base class for object events. Used for add, edit, and remove actions.
 */
public abstract class ObjectEvent {
private final Actions mAction;

protected ObjectEvent(Actions action) {
	mAction = action;
}

/**
 * Get the action to take on the object event
 * @return the action to take on the object event
 */
public Actions getAction() {
	return mAction;
}

/**
 * The different actions
 */
public enum Actions {
	ADD,
	EDIT,
	REMOVE,
}
}

package com.spiddekauga.android.util;

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

/**
 * Base class for object events. Used for add, edit, and remove actions.
 */
public abstract class ObjectEvent<ObjectType> {
private final Actions mAction;
private final List<ObjectType> mObjects = new ArrayList<>();

protected ObjectEvent(ObjectType object, Actions action) {
	mAction = action;
	mObjects.add(object);
}

protected ObjectEvent(List<ObjectType> objects, Actions action) {
	if (objects.isEmpty()) {
		throw new IllegalArgumentException("objects is empty");
	}
	
	mAction = action;
	mObjects.addAll(objects);
}

/**
 * @return all objects in this event
 */
public List<ObjectType> getObjects() {
	return mObjects;
}

/**
 * @return the first object in this event
 */
public ObjectType getFirstObject() {
	return mObjects.get(0);
}

/**
 * Get the action to take on the object event
 * @return the action to take on the object event
 */
public Actions getAction() {
	return mAction;
}

/**
 * The different actions
 */
public enum Actions {
	ADD,
	EDIT,
	REMOVE,
	/** Called after {@link #ADD}, i.e., after an object has been added to the DB */
	ADDED,
	/** Called after {@link #EDIT}, i.e., after an object has been edited in the DB */
	EDITED,
	/** Called after {@link #REMOVED}, i.e., after an objects has been removed from the DB */
	REMOVED,
}
}

Add ability to store items in the Object