com.dooapp.gaedo.prevalence.space.commands.RemoveFromCollection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gaedo-prevalence Show documentation
Show all versions of gaedo-prevalence Show documentation
A gaedo-inspired prevalence layer and the associated service, for making the most gaedo-efficient use of that layer
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