@Test public void test_getExtensionLoader_Null() throws Exception { try { ExtensionLoader.getExtensionLoader(null); fail(); } catch (IllegalArgumentException expected) { assertThat(expected.getMessage(), containsString("Extension type == null")); } }
@SuppressWarnings("unchecked") public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> type) { if (type == null) throw new IllegalArgumentException("Extension type == null"); if (!type.isInterface()) { throw new IllegalArgumentException("Extension type(" + type.getName() + ") is not interface!"); } if (!withExtensionAnnotation(type)) { throw new IllegalArgumentException("type(" + type.getName() + ") is not a extension, because WITHOUT @Extension Annotation!"); } ExtensionLoader<T> loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); if (loader == null) { EXTENSION_LOADERS.putIfAbsent(type, new ExtensionLoader<T>(type)); loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); } return loader; }
ExtensionLoader { @SuppressWarnings("unchecked") public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> type) { if (type == null) throw new IllegalArgumentException("Extension type == null"); if (!type.isInterface()) { throw new IllegalArgumentException("Extension type(" + type.getName() + ") is not interface!"); } if (!withExtensionAnnotation(type)) { throw new IllegalArgumentException("type(" + type.getName() + ") is not a extension, because WITHOUT @Extension Annotation!"); } ExtensionLoader<T> loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); if (loader == null) { EXTENSION_LOADERS.putIfAbsent(type, new ExtensionLoader<T>(type)); loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); } return loader; } }
ExtensionLoader { @SuppressWarnings("unchecked") public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> type) { if (type == null) throw new IllegalArgumentException("Extension type == null"); if (!type.isInterface()) { throw new IllegalArgumentException("Extension type(" + type.getName() + ") is not interface!"); } if (!withExtensionAnnotation(type)) { throw new IllegalArgumentException("type(" + type.getName() + ") is not a extension, because WITHOUT @Extension Annotation!"); } ExtensionLoader<T> loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); if (loader == null) { EXTENSION_LOADERS.putIfAbsent(type, new ExtensionLoader<T>(type)); loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); } return loader; } private  ExtensionLoader(Class<T> type); }
ExtensionLoader { @SuppressWarnings("unchecked") public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> type) { if (type == null) throw new IllegalArgumentException("Extension type == null"); if (!type.isInterface()) { throw new IllegalArgumentException("Extension type(" + type.getName() + ") is not interface!"); } if (!withExtensionAnnotation(type)) { throw new IllegalArgumentException("type(" + type.getName() + ") is not a extension, because WITHOUT @Extension Annotation!"); } ExtensionLoader<T> loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); if (loader == null) { EXTENSION_LOADERS.putIfAbsent(type, new ExtensionLoader<T>(type)); loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); } return loader; } private  ExtensionLoader(Class<T> type); @SuppressWarnings("unchecked") static ExtensionLoader<T> getExtensionLoader(Class<T> type); void registerExtension(String name, T extension); void registerExtension(String name, T extension, boolean override); T getExtension(String name); T getExtension(String name, Map<String, String> properties); T getExtension(Map<String, String> properties); T getExtension(String name, List<String> wrappers); T getExtension(String name, Map<String, String> properties, List<String> wrappers); T getDefaultExtension(); T getDefaultExtension(List<String> wrappers); boolean hasExtension(String name); boolean hasDefaultExtension(); Set<String> getSupportedExtensions(); String getDefaultExtensionName(); Map<String, Map<String, String>> getExtensionAttribute(); Map<String, String> getExtensionAttribute(String name); @Override String toString(); }
ExtensionLoader { @SuppressWarnings("unchecked") public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> type) { if (type == null) throw new IllegalArgumentException("Extension type == null"); if (!type.isInterface()) { throw new IllegalArgumentException("Extension type(" + type.getName() + ") is not interface!"); } if (!withExtensionAnnotation(type)) { throw new IllegalArgumentException("type(" + type.getName() + ") is not a extension, because WITHOUT @Extension Annotation!"); } ExtensionLoader<T> loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); if (loader == null) { EXTENSION_LOADERS.putIfAbsent(type, new ExtensionLoader<T>(type)); loader = (ExtensionLoader<T>) EXTENSION_LOADERS.get(type); } return loader; } private  ExtensionLoader(Class<T> type); @SuppressWarnings("unchecked") static ExtensionLoader<T> getExtensionLoader(Class<T> type); void registerExtension(String name, T extension); void registerExtension(String name, T extension, boolean override); T getExtension(String name); T getExtension(String name, Map<String, String> properties); T getExtension(Map<String, String> properties); T getExtension(String name, List<String> wrappers); T getExtension(String name, Map<String, String> properties, List<String> wrappers); T getDefaultExtension(); T getDefaultExtension(List<String> wrappers); boolean hasExtension(String name); boolean hasDefaultExtension(); Set<String> getSupportedExtensions(); String getDefaultExtensionName(); Map<String, Map<String, String>> getExtensionAttribute(); Map<String, String> getExtensionAttribute(String name); @Override String toString();  }