Package: DefaultInstanceLoader$DefaultInstanceLoaderBuilder
DefaultInstanceLoader$DefaultInstanceLoaderBuilder
name | instruction | branch | complexity | line | method | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DefaultInstanceLoader.DefaultInstanceLoaderBuilder() |
|
|
|
|
|
||||||||||||||||||||
build() |
|
|
|
|
|
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.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: 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: static DefaultInstanceLoaderBuilder builder() {
36: return new DefaultInstanceLoaderBuilder();
37: }
38:
39: static class DefaultInstanceLoaderBuilder extends EntityInstanceLoaderBuilder {
40:
41: @Override
42: EntityInstanceLoader build() {
43: return new DefaultInstanceLoader(this);
44: }
45: }
46: }