1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.plugin.surefire.util;
20
21 import javax.annotation.Nonnull;
22
23
24
25
26
27
28 public final class Relocator {
29 private static final String RELOCATION_BASE = "org.apache.maven.";
30 private static final String PACKAGE_DELIMITER = "shadefire";
31
32 private Relocator() {
33 throw new IllegalStateException("no instantiable constructor");
34 }
35
36 @Nonnull
37 public static String relocate(@Nonnull String className) {
38 if (className.contains(PACKAGE_DELIMITER)) {
39 return className;
40 } else {
41 if (!className.startsWith(RELOCATION_BASE)) {
42 throw new IllegalArgumentException("'" + className + "' should start with '" + RELOCATION_BASE + "'");
43 }
44 String rest = className.substring(RELOCATION_BASE.length());
45 final String s = RELOCATION_BASE + PACKAGE_DELIMITER + ".";
46 return s + rest;
47 }
48 }
49 }