-
Notifications
You must be signed in to change notification settings - Fork 0
Unbind_en
رامي مناف edited this page Aug 27, 2020
·
4 revisions
This command will help you when you want to delete objects. This class has three constructors. The first one has a Class varargs parameter and when you pass any class to it, it will remove all the instance from that class that is bound to the specified binding name (specify the binding name using from()). The second one has an Object varargs parameter which will receive the objects that you want to remove it from the database (all the objects should be from the same class), but be careful when you try to do this because the command will check the equality using the equal(Object) method. The third one is the same as the second one but receives objects as a List. This example will show you how to use this command:
public class Unbinding {
public static void main(String[] args) throws SofofException {
Server s = new Server(new File("sofof"), 6969, false);
s.createDatabase();
s.getUsers().add(new User("rami", "secret"));
s.startUp();
Session sess = SessionManager.startSession("sofof:localhost:6969", new User("rami", "secret"), false);
sess.execute(new Unbind(String.class));//remove all the String objects from the default binding name
sess.execute(new Unbind("Rami").from("Memberes"));
sess.execute(new Unbind(Arrays.asList("Apple", "Orange")).from("Food_List"));
}
}