Skip to content

Package: KapuaEidConverter

KapuaEidConverter

nameinstructionbranchcomplexitylinemethod
KapuaEidConverter()
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%
convertToDatabaseColumn(KapuaEid)
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%
convertToEntityAttribute(BigInteger)
M: 5 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 1 C: 0
0%
M: 1 C: 0
0%

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2016, 2022 Eurotech and/or its affiliates and others
3: *
4: * This program and the accompanying materials are made
5: * available under the terms of the Eclipse Public License 2.0
6: * which is available at https://www.eclipse.org/legal/epl-2.0/
7: *
8: * SPDX-License-Identifier: EPL-2.0
9: *
10: * Contributors:
11: * Eurotech - initial API and implementation
12: *******************************************************************************/
13: package org.eclipse.kapua.commons.model.id;
14:
15: import java.math.BigInteger;
16:
17: import javax.persistence.AttributeConverter;
18:
19: /**
20: * Kapua identifier converter used by persistence operations to convert the entity from and to database.
21: *
22: * @since 1.0
23: *
24: */
25: public class KapuaEidConverter implements AttributeConverter<KapuaEid, BigInteger> {
26:
27: @Override
28: public BigInteger convertToDatabaseColumn(KapuaEid keid) {
29: return keid.getId();
30: }
31:
32: @Override
33: public KapuaEid convertToEntityAttribute(BigInteger id) {
34: return new KapuaEid(id);
35: }
36: }