1
2
3
4
5
6
7
8
9
10
11
12
13
14 package com.addthis.codec.plugins;
15
16 import com.google.common.annotations.Beta;
17
18 @Beta
19 public final class Plugins {
20 private Plugins() {}
21
22 public static String classNameSuggestions(PluginRegistry pluginRegistry,
23 PluginMap pluginMap,
24 String type) {
25 StringBuilder builder = new StringBuilder();
26
27 builder.append("Could not instantiate an instance of the ")
28 .append(pluginMap.category()).append(" category that you have specified")
29 .append(" with \"").append(type).append("\".");
30
31 if (pluginRegistry != null) {
32 for (PluginMap otherMap : pluginRegistry.asMap().values()) {
33 if (otherMap.asBiMap().containsKey(type)) {
34 builder.append("\nIt looks like you tried to instantiate a ")
35 .append(otherMap.category()).append('.');
36 return builder.toString();
37 }
38 }
39 }
40
41 builder.append("\nPerhaps you intended one of the following: ")
42 .append(pluginMap.asBiMap().keySet());
43 return builder.toString();
44 }
45 }