Skip to content

Package: BasicTypeImpl

BasicTypeImpl

nameinstructionbranchcomplexitylinemethod
BasicTypeImpl(Class)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
equals(Object)
M: 35 C: 0
0%
M: 10 C: 0
0%
M: 6 C: 0
0%
M: 10 C: 0
0%
M: 1 C: 0
0%
get(Class)
M: 0 C: 5
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
getJavaType()
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: 2 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%
hashCode()
M: 19 C: 0
0%
M: 2 C: 0
0%
M: 2 C: 0
0%
M: 4 C: 0
0%
M: 1 C: 0
0%

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: public class BasicTypeImpl<X> implements BasicType<X> {
21:
22: private final Class<X> c;
23:
24: BasicTypeImpl(Class<X> c) {
25: this.c = c;
26: }
27:
28: @Override
29: public Class<X> getJavaType() {
30: return c;
31: }
32:
33: @Override
34: public cz.cvut.kbss.jopa.model.metamodel.Type.PersistenceType getPersistenceType() {
35: return PersistenceType.BASIC;
36: }
37:
38: public static <X> BasicType<X> get(final Class<X> c) {
39: return new BasicTypeImpl<>(c);
40: }
41:
42: @Override
43: public int hashCode() {
44: final int prime = 31;
45: int result = 1;
46:• result = prime * result + ((c == null) ? 0 : c.hashCode());
47: return result;
48: }
49:
50: @Override
51: public boolean equals(Object obj) {
52:• if (this == obj)
53: return true;
54:• if (obj == null)
55: return false;
56:• if (getClass() != obj.getClass())
57: return false;
58: BasicTypeImpl<?> other = (BasicTypeImpl<?>) obj;
59:• if (c == null) {
60:• return other.c == null;
61: } else return c.equals(other.c);
62: }
63: }