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%
createDeleteObjectChangeSet(Object, Descriptor)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
createObjectChangeSet(Object, Object, Descriptor)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
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%

Coverage

1: /*
2: * JOPA
3: * Copyright (C) 2023 Czech Technical University in Prague
4: *
5: * This library is free software; you can redistribute it and/or
6: * modify it under the terms of the GNU Lesser General Public
7: * License as published by the Free Software Foundation; either
8: * version 3.0 of the License, or (at your option) any later version.
9: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library.
17: */
18: package cz.cvut.kbss.jopa.sessions.change;
19:
20: import cz.cvut.kbss.jopa.model.descriptors.Descriptor;
21: import cz.cvut.kbss.jopa.sessions.ObjectChangeSet;
22: import cz.cvut.kbss.jopa.sessions.UnitOfWorkChangeSet;
23:
24: public class ChangeSetFactory {
25:
26: private ChangeSetFactory() {
27: throw new AssertionError();
28: }
29:
30: /**
31: * Creates change set for the specified UnitOfWork.
32: *
33: * @return New change set
34: */
35: public static UnitOfWorkChangeSet createUoWChangeSet() {
36: return new UnitOfWorkChangeSetImpl();
37: }
38:
39: /**
40: * Creates new change set for the specified original-clone pair.
41: *
42: * @param original
43: * Original object
44: * @param clone
45: * Clone
46: * @param descriptor
47: * Entity descriptor
48: * @return New object change set
49: */
50: public static ObjectChangeSet createObjectChangeSet(Object original, Object clone, Descriptor descriptor) {
51: return new ObjectChangeSetImpl(original, clone, descriptor);
52: }
53:
54: /**
55: * Creates a new change set representing object removal.
56: * @param toDelete Object to remove
57: * @param descriptor Entity descriptor
58: * @return New object change set
59: */
60: public static ObjectChangeSet createDeleteObjectChangeSet(Object toDelete, Descriptor descriptor) {
61: return new DeleteObjectChangeSet(toDelete, descriptor);
62: }
63: }