Skip to content

Package: EntityTypeImpl

EntityTypeImpl

nameinstructionbranchcomplexitylinemethod
EntityTypeImpl(String, Class, IRI)
M: 0 C: 10
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
getBindableJavaType()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getBindableType()
M: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getIRI()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getInheritanceType()
M: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getName()
M: 3 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
getPersistenceType()
M: 0 C: 2
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
setInheritanceType(InheritanceType)
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%
setSupertype(AbstractIdentifiableType)
M: 0 C: 13
100%
M: 0 C: 2
100%
M: 0 C: 2
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
toString()
M: 0 C: 17
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.model.metamodel;
16:
17: import cz.cvut.kbss.jopa.model.IRI;
18: import cz.cvut.kbss.jopa.model.annotations.InheritanceType;
19:
20: public class EntityTypeImpl<X> extends AbstractIdentifiableType<X> implements EntityType<X> {
21:
22: private final String name;
23:
24: private final IRI iri;
25:
26: private InheritanceType inheritanceType;
27:
28: public EntityTypeImpl(String name, Class<X> javaType, final IRI iri) {
29: super(javaType);
30: this.name = name;
31: this.iri = iri;
32: }
33:
34: @Override
35: public String getName() {
36: return name;
37: }
38:
39: @Override
40: public PersistenceType getPersistenceType() {
41: return PersistenceType.ENTITY;
42: }
43:
44: @Override
45: public Class<X> getBindableJavaType() {
46: return getJavaType();
47: }
48:
49: @Override
50: public BindableType getBindableType() {
51: return BindableType.ENTITY_TYPE;
52: }
53:
54: @Override
55: public IRI getIRI() {
56: return iri;
57: }
58:
59: @Override
60: void setSupertype(AbstractIdentifiableType<? super X> supertype) {
61: super.setSupertype(supertype);
62:• if (supertype.getPersistenceType() == PersistenceType.ENTITY) {
63: this.inheritanceType = ((EntityTypeImpl) supertype).inheritanceType;
64: }
65: }
66:
67: /**
68: * Gets inheritance type of this entity type.
69: * <p>
70: * If the entity type is a root if an inheritance hierarchy, the type can be defined using the {@link
71: * cz.cvut.kbss.jopa.model.annotations.Inheritance} annotation. If the entity is deeper in inheritance hierarchy, it
72: * is inherited from the supertype. Otherwise, it defaults to {@link cz.cvut.kbss.jopa.utils.Constants#DEFAULT_INHERITANCE_TYPE}.
73: *
74: * @return Inheritance strategy for this entity type
75: */
76: public InheritanceType getInheritanceType() {
77: return inheritanceType;
78: }
79:
80: void setInheritanceType(InheritanceType inheritanceType) {
81: this.inheritanceType = inheritanceType;
82: }
83:
84: @Override
85: public String toString() {
86: return "EntityType{" + name + "<" + iri + ">}";
87: }
88: }