com.strider.datadefender.functions.Utils   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 62.5%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 18
c 3
b 0
f 0
dl 0
loc 53
ccs 10
cts 16
cp 0.625
rs 10
wmc 6

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getClassName(String) 0 14 3
A getMethodName(String) 0 14 3
1
/*
2
 * Copyright 2014, Armenak Grigoryan, and individual contributors as indicated
3
 * by the @authors tag. See the copyright.txt in the distribution for a
4
 * full listing of individual contributors.
5
 *
6
 * This is free software; you can redistribute it and/or modify it
7
 * under the terms of the GNU Lesser General Public License as
8
 * published by the Free Software Foundation; either version 2.1 of
9
 * the License, or (at your option) any later version.
10
 *
11
 * This software is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
 * Lesser General Public License for more details.
15
 */
16
package com.strider.datadefender.functions;
17
18
import lombok.extern.log4j.Log4j2;
19
20
/**
21
 *
22
 * @author Armenak Grigoryan
23
 */
24
@Log4j2
25
public class Utils {
26
27
    /**
28
     * The string used to separator package and class name
29
     */
30
    public static final String SEPARATOR = ".";
31
32
    /**
33
     * Returns fully specified class name.
34
     *
35
     * @param fullMethodName Fully specified method name.
36
     * @return Method name.
37
     *
38
     * @throws RuntimeException Parameter is an empty string.
39
     */
40 1
    public static String getClassName(final String fullMethodName) {
41 2
        if (fullMethodName.length() == 0) {
42
            log.error("Please specify fully specified methid name in Requirement document");
43
44
            return "";
45
        }
46
47 1
        final int index = fullMethodName.lastIndexOf(SEPARATOR);
48
49 2
        if (index != -1) {
50 1
            return fullMethodName.substring(0, index);
51
        }
52
53
        return "";
54
    }
55
56
    /**
57
     * Returns the method name.
58
     *
59
     * @param fullMethodName Fully specified method name.
60
     * @return Method name.
61
     * @throws com.strider.datadefender.DatabaseAnonymizerException
62
     */
63 1
    public static String getMethodName(final String fullMethodName) {
64 2
        if (fullMethodName.length() == 0) {
65
            log.error("Please specify fully specified methid name in Requirement document");
66
67
            return "";
68
        }
69
70 1
        final int index = fullMethodName.lastIndexOf(SEPARATOR);
71
72 2
        if (index != -1) {
73 1
            return fullMethodName.substring(index + 1);
74
        }
75
76
        return "";
77
    }
78
}
79