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