Skip to content

Package: ChangeManager

ChangeManager

Coverage

1: /**
2: * Copyright (C) 2016 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.sessions;
16:
17: public interface ChangeManager {
18:
19: /**
20: * This method does a quick check to find out whether there are any changes
21: * to the clone. It does a object value comparison, i. e. it compares each
22: * value of the clone against the original value and returns true if a
23: * change is found.
24: *
25: * @param original The original object.
26: * @param clone The clone, whose changes we are looking for.
27: * @return True if there is a change (at least one) or false, if the values are identical.
28: */
29: boolean hasChanges(Object original, Object clone);
30:
31: /**
32: * Calculates the changes that happened to the clone object. If there are no
33: * changes, null is returned. The changes are written into the change set
34: * passed in as argument.
35: *
36: * @param changeSet Contains references to the original and clone objects. Into this change set the changes should
37: * be propagated
38: * @return {@code true} if there were any changes, {@code false} otherwise
39: * @throws NullPointerException If {@code changeSet} is {@code null}
40: */
41: boolean calculateChanges(ObjectChangeSet changeSet);
42:
43: }