Skip to content

Package: IdentifiableEntityType

IdentifiableEntityType

nameinstructionbranchcomplexitylinemethod
IdentifiableEntityType(Class, IRI)
M: 0 C: 11
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: 0 C: 3
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
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%
toString()
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * JOPA
3: * Copyright (C) 2024 Czech Technical University in Prague
4: *
5: * This library is free software; you can redistribute it and/or
6: * modify it under the terms of the GNU Lesser General Public
7: * License as published by the Free Software Foundation; either
8: * version 3.0 of the License, or (at your option) any later version.
9: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library.
17: */
18: package cz.cvut.kbss.jopa.model.metamodel;
19:
20: import cz.cvut.kbss.jopa.model.IRI;
21: import cz.cvut.kbss.jopa.model.annotations.InheritanceType;
22:
23: /**
24: * Instances of this type represent entity classes that can be saved to and read from storage.
25: *
26: * @param <X> Entity class being represented by this instance
27: */
28: public abstract class IdentifiableEntityType<X> extends AbstractIdentifiableType<X> implements EntityType<X> {
29:
30: private final String name;
31:
32: private final IRI iri;
33:
34: private InheritanceType inheritanceType;
35:
36: public IdentifiableEntityType(Class<X> javaType, final IRI iri) {
37: super(javaType);
38: this.name = javaType.getSimpleName();
39: this.iri = iri;
40: }
41:
42: @Override
43: public String getName() {
44: return name;
45: }
46:
47: @Override
48: public PersistenceType getPersistenceType() {
49: return PersistenceType.ENTITY;
50: }
51:
52: @Override
53: public Class<X> getBindableJavaType() {
54: return getJavaType();
55: }
56:
57: @Override
58: public BindableType getBindableType() {
59: return BindableType.ENTITY_TYPE;
60: }
61:
62: @Override
63: public IRI getIRI() {
64: return iri;
65: }
66:
67:
68: /**
69: * Gets inheritance type of this entity type.
70: * <p>
71: * If the entity type is a root if an inheritance hierarchy, the type can be defined using the
72: * {@link cz.cvut.kbss.jopa.model.annotations.Inheritance} annotation. If the entity is deeper in inheritance
73: * hierarchy, it is inherited from the supertype. Otherwise, it defaults to
74: * {@link cz.cvut.kbss.jopa.utils.Constants#DEFAULT_INHERITANCE_TYPE}.
75: *
76: * @return Inheritance strategy for this entity type
77: */
78: public InheritanceType getInheritanceType() {
79: return inheritanceType;
80: }
81:
82: void setInheritanceType(InheritanceType inheritanceType) {
83: this.inheritanceType = inheritanceType;
84: }
85:
86: @Override
87: public String toString() {
88: return "EntityType{" + name + "<" + iri + ">}";
89: }
90: }