package vg.civcraft.mc.civmodcore.serialization;

public class ExampleSerializable implements NBTSerializable {

	private String message;

	public String getMessage() {
		return this.message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	@Override
	public void serialize(NBTCompound nbt) throws NBTSerializationException {
		nbt.setString("message", this.message);
	}

	@Override
	public void deserialize(NBTCompound nbt) throws NBTSerializationException {
		this.message = nbt.getString("message");
	}

}

package vg.civcraft.mc.civmodcore.serialization;

/**
 * Class to be used during testing as an example serializable.
 */
public final class ExampleSerializable extends NBTCache {

	private static final String MESSAGE_KEY = "message";

	/**
	 * Gets the message stored within the NBT directly.
	 *
	 * @return Returns the message stored within this class' NBT.
	 */
	public String getMessage() {
		return this.nbt.getString(MESSAGE_KEY);
	}

	/**
	 * Assigns a message to this class' NBT.
	 *
	 * @param message The message to assign.
	 */
	public void setMessage(String message) {
		this.nbt.setString(MESSAGE_KEY, message);
	}

}

Test :: ExampleSerializable swapped over to NBTCache