Skip to content

Package: ListPropertyStrategy

ListPropertyStrategy

nameinstructionbranchcomplexitylinemethod
ListPropertyStrategy(EntityType, ListAttribute, Descriptor, EntityMappingHelper)
M: 0 C: 10
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
buildAxiomValuesFromInstance(Object, AxiomValueGatherer)
M: 4 C: 17
81%
M: 1 C: 3
75%
M: 1 C: 2
67%
M: 0 C: 4
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.oom;
16:
17: import cz.cvut.kbss.jopa.model.descriptors.Descriptor;
18: import cz.cvut.kbss.jopa.model.metamodel.EntityType;
19: import cz.cvut.kbss.jopa.model.metamodel.ListAttribute;
20: import cz.cvut.kbss.ontodriver.descriptor.ListDescriptor;
21: import cz.cvut.kbss.ontodriver.descriptor.ListValueDescriptor;
22: import cz.cvut.kbss.ontodriver.model.Axiom;
23:
24: import java.util.List;
25:
26: abstract class ListPropertyStrategy<L extends ListDescriptor, V extends ListValueDescriptor, X>
27: extends PluralObjectPropertyStrategy<X> {
28:
29: protected final ListAttribute<? super X, ?> listAttribute;
30:
31: public ListPropertyStrategy(EntityType<X> et, ListAttribute<? super X, ?> att, Descriptor descriptor,
32: EntityMappingHelper mapper) {
33: super(et, att, descriptor, mapper);
34: this.listAttribute = att;
35: }
36:
37: @Override
38: protected void buildAxiomValuesFromInstance(X instance, AxiomValueGatherer valueBuilder)
39: throws IllegalAccessException {
40: final Object value = extractFieldValueFromInstance(instance);
41:• assert (value instanceof List || value == null);
42: extractListValues((List<?>) value, instance, valueBuilder);
43: }
44:
45: abstract L createListDescriptor(Axiom<?> ax);
46:
47: abstract V createListValueDescriptor(X instance);
48:
49: abstract <K> void extractListValues(List<K> list, X instance,
50: AxiomValueGatherer valueBuilder);
51: }