Fetch the active plugins matching the given type. This will exclude plugins that are disabled. @param type Class of plugin. @param Plugin type. @return Collection of active plugins matching the given type.
(Class<T> type)
| 145 | * @return Collection of active plugins matching the given type. |
| 146 | */ |
| 147 | @SuppressWarnings("unchecked") |
| 148 | public <T extends BasePlugin> Collection<T> ofType(Class<T> type) { |
| 149 | return plugins().values().stream() |
| 150 | .filter(plugin -> type.isAssignableFrom(plugin.getClass())) |
| 151 | .filter(plugin -> pluginStates.getOrDefault(plugin.getName(), false)) |
| 152 | .map(plugin -> (T) plugin) |
| 153 | .collect(Collectors.toList()); |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * @return Plugins manager instance. |
no test coverage detected