Skip to content

Package: LoadingParameters

LoadingParameters

nameinstructionbranchcomplexitylinemethod
LoadingParameters(Class, URI, Descriptor)
M: 4 C: 19
83%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 7
100%
M: 0 C: 1
100%
LoadingParameters(Class, URI, Descriptor, boolean)
M: 4 C: 19
83%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 7
100%
M: 0 C: 1
100%
bypassCache()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
equals(Object)
M: 10 C: 39
80%
M: 5 C: 7
58%
M: 5 C: 2
29%
M: 0 C: 8
100%
M: 0 C: 1
100%
getDescriptor()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getEntityType()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getIdentifier()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
hashCode()
M: 44 C: 0
0%
M: 4 C: 0
0%
M: 3 C: 0
0%
M: 6 C: 0
0%
M: 1 C: 0
0%
isForceEager()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
paramsLoaded()
M: 1 C: 12
92%
M: 3 C: 3
50%
M: 3 C: 1
25%
M: 0 C: 1
100%
M: 0 C: 1
100%
shouldBypassCache()
M: 0 C: 3
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;
16:
17: import cz.cvut.kbss.jopa.model.descriptors.Descriptor;
18:
19: import java.net.URI;
20:
21: public final class LoadingParameters<T> {
22:
23: private final Class<T> cls;
24: private final URI identifier;
25: private final Descriptor descriptor;
26: private final boolean forceEager;
27: private boolean bypassCache;
28:
29: public LoadingParameters(Class<T> cls, URI identifier, Descriptor descriptor) {
30: this.cls = cls;
31: this.identifier = identifier;
32: this.descriptor = descriptor;
33: this.forceEager = false;
34:• assert paramsLoaded();
35: }
36:
37: public LoadingParameters(Class<T> cls, URI identifier, Descriptor descriptor, boolean forceEager) {
38: this.cls = cls;
39: this.identifier = identifier;
40: this.descriptor = descriptor;
41: this.forceEager = forceEager;
42:• assert paramsLoaded();
43: }
44:
45: private boolean paramsLoaded() {
46:• return cls != null && identifier != null && descriptor != null;
47: }
48:
49: public Class<T> getEntityType() {
50: return cls;
51: }
52:
53: public URI getIdentifier() {
54: return identifier;
55: }
56:
57: public Descriptor getDescriptor() {
58: return descriptor;
59: }
60:
61: public boolean isForceEager() {
62: return forceEager;
63: }
64:
65: public boolean shouldBypassCache() {
66: return bypassCache;
67: }
68:
69: public void bypassCache() {
70: this.bypassCache = true;
71: }
72:
73: @Override
74: public boolean equals(Object o) {
75:• if (this == o) return true;
76:• if (!(o instanceof LoadingParameters)) return false;
77:
78: LoadingParameters<?> that = (LoadingParameters<?>) o;
79:
80:• if (forceEager != that.forceEager) return false;
81:• if (bypassCache != that.bypassCache) return false;
82:• if (!cls.equals(that.cls)) return false;
83:• if (!identifier.equals(that.identifier)) return false;
84: return descriptor.equals(that.descriptor);
85: }
86:
87: @Override
88: public int hashCode() {
89: int result = cls.hashCode();
90: result = 31 * result + identifier.hashCode();
91: result = 31 * result + descriptor.hashCode();
92:• result = 31 * result + (forceEager ? 1 : 0);
93:• result = 31 * result + (bypassCache ? 1 : 0);
94: return result;
95: }
96: }