Skip to content

Package: IdentifierFieldStrategy

IdentifierFieldStrategy

nameinstructionbranchcomplexitylinemethod
IdentifierFieldStrategy(EntityType, Identifier, Descriptor, EntityMappingHelper)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
addValueFromAxiom(Axiom)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
buildAxiomValuesFromInstance(Object, AxiomValueGatherer)
M: 0 C: 14
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
buildInstanceFieldValue(Object)
M: 1 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
createAssertion()
M: 4 C: 12
75%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 2
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) 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.descriptors.Descriptor;
18: import cz.cvut.kbss.jopa.model.metamodel.EntityType;
19: import cz.cvut.kbss.jopa.model.metamodel.Identifier;
20: import cz.cvut.kbss.ontodriver.model.Assertion;
21: import cz.cvut.kbss.ontodriver.model.Axiom;
22: import cz.cvut.kbss.ontodriver.model.Value;
23:
24: class IdentifierFieldStrategy<X> extends FieldStrategy<Identifier<? super X, ?>, X> {
25:
26: IdentifierFieldStrategy(EntityType<X> et, Identifier<? super X, ?> att, Descriptor attributeDescriptor,
27: EntityMappingHelper mapper) {
28: super(et, att, attributeDescriptor, mapper);
29: }
30:
31: @Override
32: void addValueFromAxiom(Axiom<?> ax) {
33: // Do nothing
34: }
35:
36: @Override
37: void buildInstanceFieldValue(Object instance) {
38: // Do nothing
39: }
40:
41: @Override
42: void buildAxiomValuesFromInstance(X instance, AxiomValueGatherer valueBuilder) {
43: valueBuilder.addValue(createAssertion(), new Value<>(et.getIRI().toURI()), getAttributeContext());
44: }
45:
46: @Override
47: Assertion createAssertion() {
48:• assert !attribute.isInferred();
49: return Assertion.createClassAssertion(attribute.isInferred());
50: }
51: }