mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-11 16:05:44 +01:00
fix generic handling of extension processor
This commit is contained in:
@@ -98,9 +98,10 @@ public final class Priorities
|
||||
*
|
||||
* @return sorted class list
|
||||
*/
|
||||
public static <T> List<Class<T>> sort(Iterable<Class<T>> unordered)
|
||||
public static <T> List<Class<? extends T>> sort(
|
||||
Iterable<Class<? extends T>> unordered)
|
||||
{
|
||||
return new PriorityOrdering().sortedCopy(unordered);
|
||||
return new PriorityOrdering<T>().sortedCopy(unordered);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
@@ -133,7 +134,7 @@ public final class Priorities
|
||||
*
|
||||
* @param <T> type of class
|
||||
*/
|
||||
public static class PriorityOrdering<T> extends Ordering<Class<T>>
|
||||
public static class PriorityOrdering<T> extends Ordering<Class<? extends T>>
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -146,7 +147,7 @@ public final class Priorities
|
||||
* @return compare value
|
||||
*/
|
||||
@Override
|
||||
public int compare(Class<T> left, Class<T> right)
|
||||
public int compare(Class<? extends T> left, Class<? extends T> right)
|
||||
{
|
||||
return Ints.compare(getPriority(left), getPriority(right));
|
||||
}
|
||||
|
||||
@@ -50,10 +50,11 @@ public interface ExtensionProcessor
|
||||
*
|
||||
* @param <T> type of extension
|
||||
* @param extensionPoint extension point
|
||||
*
|
||||
*
|
||||
* @return extensions
|
||||
*/
|
||||
public <T> Iterable<Class<T>> byExtensionPoint(Class<T> extensionPoint);
|
||||
public <T> Iterable<Class<? extends T>> byExtensionPoint(
|
||||
Class<T> extensionPoint);
|
||||
|
||||
/**
|
||||
* Returns single extension by its extension point.
|
||||
@@ -61,10 +62,10 @@ public interface ExtensionProcessor
|
||||
*
|
||||
* @param <T> type of extension
|
||||
* @param extensionPoint extension point
|
||||
*
|
||||
*
|
||||
* @return extension
|
||||
*/
|
||||
public <T> Class<T> oneByExtensionPoint(Class<T> extensionPoint);
|
||||
public <T> Class<? extends T> oneByExtensionPoint(Class<T> extensionPoint);
|
||||
|
||||
/**
|
||||
* Process auto bind extensions.
|
||||
|
||||
@@ -217,7 +217,7 @@ public class ScmContextListener extends GuiceServletContextListener
|
||||
*/
|
||||
private void appendModules(ExtensionProcessor ep, List<Module> moduleList)
|
||||
{
|
||||
for (Class<Module> module : ep.byExtensionPoint(Module.class))
|
||||
for (Class<? extends Module> module : ep.byExtensionPoint(Module.class))
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -102,7 +102,7 @@ public class ScmSecurityModule extends ShiroWebModule
|
||||
expose(PasswordService.class);
|
||||
|
||||
// bind realm
|
||||
for (Class<Realm> realm : extensionProcessor.byExtensionPoint(Realm.class))
|
||||
for (Class<? extends Realm> realm : extensionProcessor.byExtensionPoint(Realm.class))
|
||||
{
|
||||
logger.info("bind security realm {}", realm);
|
||||
bindRealm().to(realm);
|
||||
|
||||
Reference in New Issue
Block a user