Skip to content

Package: DefaultInstanceLoader

DefaultInstanceLoader

nameinstructionbranchcomplexitylinemethod
DefaultInstanceLoader(DefaultInstanceLoader.DefaultInstanceLoaderBuilder)
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%
builder()
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%
loadEntity(LoadingParameters)
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
loadReference(LoadingParameters)
M: 0 C: 11
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%

Coverage

1: /**
2: * Copyright (C) 2020 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.oom;
16:
17: import cz.cvut.kbss.jopa.model.metamodel.EntityType;
18: import cz.cvut.kbss.jopa.sessions.LoadingParameters;
19:
20: /**
21: * Loads entities which do not require polymorphic handling.
22: */
23: class DefaultInstanceLoader extends EntityInstanceLoader {
24:
25: private DefaultInstanceLoader(DefaultInstanceLoaderBuilder builder) {
26: super(builder);
27: }
28:
29: @Override
30: <T> T loadEntity(LoadingParameters<T> loadingParameters) {
31: final EntityType<T> et = metamodel.entity(loadingParameters.getEntityType());
32: return loadInstance(loadingParameters, et);
33: }
34:
35: @Override
36: <T> T loadReference(LoadingParameters<T> loadingParameters) {
37: final EntityType<T> et = metamodel.entity(loadingParameters.getEntityType());
38: return loadReferenceInstance(loadingParameters, et);
39: }
40:
41: static DefaultInstanceLoaderBuilder builder() {
42: return new DefaultInstanceLoaderBuilder();
43: }
44:
45: static class DefaultInstanceLoaderBuilder extends EntityInstanceLoaderBuilder {
46:
47: @Override
48: EntityInstanceLoader build() {
49: return new DefaultInstanceLoader(this);
50: }
51: }
52: }