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
26:          * The original object.
27:          * @param clone
28:          * The clone, whose changes we are looking for.
29:          * @return True if there is a change (at least one) or false, if the values
30:          * are identical.
31:          */
32:         public boolean hasChanges(Object original, Object clone);
33:
34:         /**
35:          * Calculates the changes that happened to the clone object. If there are no
36:          * changes, null is returned. The changes are written into the change set
37:          * passed in as argument.
38:          *
39:          * @param changeSet
40:          * Contains references to the original and clone objects. Into
41:          * this change set the changes should be propagated
42:          * @return {@code true} if there were any changes, {@code false} otherwise
43:          * @throws IllegalAccessException
44:          * @throws IllegalArgumentException
45:          * @throws NullPointerException
46:          * If {@code changeSet} is {@code null}
47:          */
48:         public boolean calculateChanges(ObjectChangeSet changeSet) throws IllegalAccessException,
49:                         IllegalArgumentException;
50:
51: }