1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package com.helger.schematron.svrl;
18
19 import java.util.List;
20
21 import javax.annotation.Nonnull;
22 import javax.annotation.Nullable;
23 import javax.annotation.concurrent.NotThreadSafe;
24
25 import org.slf4j.Logger;
26 import org.slf4j.LoggerFactory;
27
28 import com.helger.commons.annotation.PresentForCodeCoverage;
29 import com.helger.commons.debug.GlobalDebug;
30 import com.helger.commons.lang.ServiceLoaderHelper;
31
32
33
34
35
36
37 @NotThreadSafe
38 public final class SVRLLocationBeautifierRegistry
39 {
40 private static final Logger s_aLogger = LoggerFactory.getLogger (SVRLLocationBeautifierRegistry.class);
41 private static final List <ISVRLLocationBeautifierSPI> s_aList = ServiceLoaderHelper.getAllSPIImplementations (ISVRLLocationBeautifierSPI.class);
42
43 @PresentForCodeCoverage
44 private static final SVRLLocationBeautifierRegistry s_aInstance = new SVRLLocationBeautifierRegistry ();
45
46 private SVRLLocationBeautifierRegistry ()
47 {}
48
49
50
51
52
53
54
55
56
57
58 @Nullable
59 public static String getBeautifiedLocation (@Nonnull final String sNamespaceURI, @Nonnull final String sLocalName)
60 {
61 for (final ISVRLLocationBeautifierSPI aBeautifier : s_aList)
62 {
63 final String sBeautified = aBeautifier.getReplacementText (sNamespaceURI, sLocalName);
64 if (sBeautified != null)
65 return sBeautified;
66 }
67 if (GlobalDebug.isDebugMode ())
68 s_aLogger.warn ("Unsupported elements for beautification: " + sNamespaceURI + " -- " + sLocalName);
69 return null;
70 }
71 }