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
|
* @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 ----------------------------------------------------------
|
//~--- get methods ----------------------------------------------------------
|
||||||
@@ -133,7 +134,7 @@ public final class Priorities
|
|||||||
*
|
*
|
||||||
* @param <T> type of class
|
* @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
|
* @return compare value
|
||||||
*/
|
*/
|
||||||
@Override
|
@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));
|
return Ints.compare(getPriority(left), getPriority(right));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,7 +53,8 @@ public interface ExtensionProcessor
|
|||||||
*
|
*
|
||||||
* @return extensions
|
* @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.
|
* Returns single extension by its extension point.
|
||||||
@@ -64,7 +65,7 @@ public interface ExtensionProcessor
|
|||||||
*
|
*
|
||||||
* @return extension
|
* @return extension
|
||||||
*/
|
*/
|
||||||
public <T> Class<T> oneByExtensionPoint(Class<T> extensionPoint);
|
public <T> Class<? extends T> oneByExtensionPoint(Class<T> extensionPoint);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process auto bind extensions.
|
* Process auto bind extensions.
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ public class ScmContextListener extends GuiceServletContextListener
|
|||||||
*/
|
*/
|
||||||
private void appendModules(ExtensionProcessor ep, List<Module> moduleList)
|
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
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ public class ScmSecurityModule extends ShiroWebModule
|
|||||||
expose(PasswordService.class);
|
expose(PasswordService.class);
|
||||||
|
|
||||||
// bind realm
|
// 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);
|
logger.info("bind security realm {}", realm);
|
||||||
bindRealm().to(realm);
|
bindRealm().to(realm);
|
||||||
|
|||||||
Reference in New Issue
Block a user