Skip to content

Package: ChangeSetFactory

ChangeSetFactory

nameinstructionbranchcomplexitylinemethod
ChangeSetFactory()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
createObjectChangeSet(Object, Object, Descriptor)
M: 8 C: 14
64%
M: 2 C: 2
50%
M: 2 C: 1
33%
M: 0 C: 3
100%
M: 0 C: 1
100%
createUoWChangeSet()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
static {...}
M: 0 C: 1
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

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.change;
16:
17: import cz.cvut.kbss.jopa.model.descriptors.Descriptor;
18: import cz.cvut.kbss.jopa.sessions.ObjectChangeSet;
19: import cz.cvut.kbss.jopa.sessions.UnitOfWorkChangeSet;
20: import cz.cvut.kbss.jopa.sessions.change.ObjectChangeSetImpl;
21: import cz.cvut.kbss.jopa.sessions.change.UnitOfWorkChangeSetImpl;
22:
23: public class ChangeSetFactory {
24:
25:         private ChangeSetFactory() {
26:                 throw new AssertionError();
27:         }
28:
29:         /**
30:          * Creates change set for the specified UnitOfWork.
31:          *
32:          * @return New change set
33:          */
34:         public static UnitOfWorkChangeSet createUoWChangeSet() {
35:                 return new UnitOfWorkChangeSetImpl();
36:         }
37:
38:         /**
39:          * Creates new change set for the specified original-clone pair.
40:          *
41:          * @param original
42:          * Original object
43:          * @param clone
44:          * Clone
45:          * @param descriptor
46:          * Entity descriptor
47:          * @return New object change set
48:          */
49:         public static ObjectChangeSet createObjectChangeSet(Object original, Object clone, Descriptor descriptor) {
50:•                assert original != null;
51:•                assert descriptor != null;
52:
53:                 return new ObjectChangeSetImpl(original, clone, descriptor.getContext());
54:         }
55: }