All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dooapp.gaedo.prevalence.space.commands.RemoveFromCollection Maven / Gradle / Ivy

Go to download

A gaedo-inspired prevalence layer and the associated service, for making the most gaedo-efficient use of that layer

There is a newer version: 1.0.16
Show newest version
package com.dooapp.gaedo.prevalence.space.commands;

import java.io.Serializable;
import java.util.Collection;

import com.dooapp.gaedo.prevalence.space.Command;
import com.dooapp.gaedo.prevalence.space.StorageSpace;

public class RemoveFromCollection implements Command, Serializable {

	private Key key;
	private Serializable value;

	public RemoveFromCollection(Key key, Serializable value) {
		this.key = key;
		this.value = value;
	}

	@Override
	public Boolean execute(StorageSpace storage) {
		// Object associated to key must be a collection.
		// This is not checked, to ensure fail-fast of this layer
		Collection content = (Collection) storage.get(key);
		return Boolean.valueOf(content.remove(value));
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy