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