Skip to content

Package: PropertiesParametersResolver

PropertiesParametersResolver

nameinstructionbranchcomplexitylinemethod
PropertiesParametersResolver(Field)
M: 4 C: 25
86%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 6
100%
M: 0 C: 1
100%
getKeyType()
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%
getPropertyIdentifierType()
M: 4 C: 9
69%
M: 1 C: 1
50%
M: 1 C: 1
50%
M: 0 C: 2
100%
M: 0 C: 1
100%
getPropertyValueType()
M: 12 C: 28
70%
M: 3 C: 3
50%
M: 3 C: 1
25%
M: 0 C: 5
100%
M: 0 C: 1
100%
getValueType()
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%
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: * 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 java.lang.reflect.*;
21:
22: class PropertiesParametersResolver {
23:
24: private final java.lang.reflect.Type keyType;
25: private final java.lang.reflect.Type valueType;
26:
27: PropertiesParametersResolver(Field propertiesField) {
28: final ParameterizedType typeSpec = (ParameterizedType) propertiesField.getGenericType();
29:• assert typeSpec.getActualTypeArguments().length == 2;
30: this.keyType = typeSpec.getActualTypeArguments()[0];
31: this.valueType = typeSpec.getActualTypeArguments()[1];
32: }
33:
34: java.lang.reflect.Type getKeyType() {
35: return keyType;
36: }
37:
38: java.lang.reflect.Type getValueType() {
39: return valueType;
40: }
41:
42: Class<?> getPropertyIdentifierType() {
43:• assert keyType instanceof Class;
44: return (Class<?>) keyType;
45: }
46:
47: Class<?> getPropertyValueType() {
48:• assert valueType instanceof ParameterizedType;
49: final ParameterizedType type = (ParameterizedType) valueType;
50:• assert type.getActualTypeArguments().length == 1;
51:• assert type.getActualTypeArguments()[0] instanceof Class;
52: return (Class<?>) type.getActualTypeArguments()[0];
53: }
54: }