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 javax.annotation.Nonnull;
20 import javax.annotation.Nullable;
21 import javax.annotation.concurrent.NotThreadSafe;
22
23 import org.slf4j.Logger;
24 import org.slf4j.LoggerFactory;
25
26 import com.helger.commons.annotation.PresentForCodeCoverage;
27 import com.helger.commons.collection.ext.ICommonsList;
28 import com.helger.commons.debug.GlobalDebug;
29 import com.helger.commons.lang.ServiceLoaderHelper;
30
31
32
33
34
35
36 @NotThreadSafe
37 public final class SVRLLocationBeautifierRegistry
38 {
39 private static final Logger s_aLogger = LoggerFactory.getLogger (SVRLLocationBeautifierRegistry.class);
40 private static final ICommonsList <ISVRLLocationBeautifierSPI> s_aList = ServiceLoaderHelper.getAllSPIImplementations (ISVRLLocationBeautifierSPI.class);
41
42 @PresentForCodeCoverage
43 private static final SVRLLocationBeautifierRegistry s_aInstance = new SVRLLocationBeautifierRegistry ();
44
45 private SVRLLocationBeautifierRegistry ()
46 {}
47
48
49
50
51
52
53
54
55
56
57 @Nullable
58 public static String getBeautifiedLocation (@Nonnull final String sNamespaceURI, @Nonnull final String sLocalName)
59 {
60 for (final ISVRLLocationBeautifierSPI aBeautifier : s_aList)
61 {
62 final String sBeautified = aBeautifier.getReplacementText (sNamespaceURI, sLocalName);
63 if (sBeautified != null)
64 return sBeautified;
65 }
66 if (GlobalDebug.isDebugMode ())
67 s_aLogger.warn ("Unsupported elements for beautification: " + sNamespaceURI + " -- " + sLocalName);
68 return null;
69 }
70 }