ApplicationListener beans get obtained on demand, supporting non-singletons as well; ApplicationListeners will be called in the order according to the Ordered contract; generified ApplicationListener interface
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -45,7 +45,7 @@ public abstract class GenericCollectionTypeResolver {
|
||||
* @param collectionClass the collection class to introspect
|
||||
* @return the generic type, or <code>null</code> if none
|
||||
*/
|
||||
public static Class getCollectionType(Class collectionClass) {
|
||||
public static Class getCollectionType(Class<? extends Collection> collectionClass) {
|
||||
return extractTypeFromClass(collectionClass, Collection.class, 0);
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public abstract class GenericCollectionTypeResolver {
|
||||
* @param mapClass the map class to introspect
|
||||
* @return the generic type, or <code>null</code> if none
|
||||
*/
|
||||
public static Class getMapKeyType(Class mapClass) {
|
||||
public static Class getMapKeyType(Class<? extends Map> mapClass) {
|
||||
return extractTypeFromClass(mapClass, Map.class, 0);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public abstract class GenericCollectionTypeResolver {
|
||||
* @param mapClass the map class to introspect
|
||||
* @return the generic type, or <code>null</code> if none
|
||||
*/
|
||||
public static Class getMapValueType(Class mapClass) {
|
||||
public static Class getMapValueType(Class<? extends Map> mapClass) {
|
||||
return extractTypeFromClass(mapClass, Map.class, 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -99,6 +99,18 @@ public abstract class GenericTypeResolver {
|
||||
return (rawType instanceof Class ? (Class) rawType : method.getReturnType());
|
||||
}
|
||||
|
||||
/**
|
||||
* Resolve the given type variable against the given class.
|
||||
* @param tv the type variable to resolve
|
||||
* @param clazz the class that defines the type variable
|
||||
* somewhere in its inheritance hierarchy
|
||||
* @return the resolved type that the variable can get replaced with,
|
||||
* or <code>null</code> if none found
|
||||
*/
|
||||
public static Type resolveTypeVariable(TypeVariable tv, Class clazz) {
|
||||
return getTypeVariableMap(clazz).get(tv);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Resolve the specified generic type against the given TypeVariable map.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -51,18 +51,13 @@ public interface Ordered {
|
||||
/**
|
||||
* Return the order value of this object, with a
|
||||
* higher value meaning greater in terms of sorting.
|
||||
* <p>Normally starting with 0 or 1, with {@link #LOWEST_PRECEDENCE}
|
||||
* indicating greatest. Same order values will result in arbitrary
|
||||
* positions for the affected objects.
|
||||
* <p>Higher value can be interpreted as lower priority,
|
||||
* consequently the first object has highest priority
|
||||
* <p>Normally starting with 0, with <code>Integer.MAX_VALUE</code>
|
||||
* indicating the greatest value. Same order values will result
|
||||
* in arbitrary positions for the affected objects.
|
||||
* <p>Higher values can be interpreted as lower priority. As a
|
||||
* consequence, the object with the lowest value has highest priority
|
||||
* (somewhat analogous to Servlet "load-on-startup" values).
|
||||
* <p>Note that order values below 0 are reserved for framework
|
||||
* purposes. Application-specified values should always be 0 or
|
||||
* greater, with only framework components (internal or third-party)
|
||||
* supposed to use lower values.
|
||||
* @return the order value
|
||||
* @see #LOWEST_PRECEDENCE
|
||||
*/
|
||||
int getOrder();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user