package fr.vergne.taskmanager.history;

public class DefaultHistorizable<T> implements Historizable<T> {

	private final boolean isNullForbiden;

	public DefaultHistorizable(boolean forbidNull) {
		isNullForbiden = forbidNull;
	}

	public DefaultHistorizable() {
		this(false);
	}

	public T get() {
		return history.getCurrentValue();
	}

	public void set(T value) {
		if (isNullForbiden && value == null) {
			throw new NullPointerException("Null values are forbidden.");
		} else {
			history.push(value);
		}
	}

	private final History<T> history = new History<T>();

	@Override
	public History<T> getHistory() {
		return history;
	}

	@Override
	public String toString() {
		return history.getCurrentValue().toString();
	}

	public boolean isNullForbiden() {
		return isNullForbiden;
	}
}

@@ -139,16 +139,206 @@
 biden;%0A%0A
+%09public DefaultHistorizable(T initialValue, boolean forbidNull) %7B%0A%09%09this(forbidNull);%0A%09%09set(initialValue);%0A%09%7D%0A%0A%09public DefaultHistorizable(T initialValue) %7B%0A%09%09this(initialValue, false);%0A%09%7D%0A%0A
 %09public 

Add constructors with initial value.