polishing

This commit is contained in:
Juergen Hoeller 2011-10-11 01:00:31 +00:00
parent 37c601c8dd
commit 339c57e41a
2 changed files with 6 additions and 7 deletions

View File

@ -116,21 +116,20 @@ public abstract class GenericTypeResolver {
public static Class<?> resolveReturnTypeArgument(Method method, Class<?> genericIfc) {
Type returnType = method.getReturnType();
Type genericReturnType = method.getGenericReturnType();
ParameterizedType targetType;
if (returnType.equals(genericIfc)) {
if (genericReturnType instanceof ParameterizedType) {
targetType = (ParameterizedType)genericReturnType;
ParameterizedType targetType = (ParameterizedType) genericReturnType;
Type[] actualTypeArguments = targetType.getActualTypeArguments();
Type typeArg = actualTypeArguments[0];
if (!(typeArg instanceof WildcardType)) {
return (Class<?>)typeArg;
return (Class<?>) typeArg;
}
}
else {
return null;
}
}
return GenericTypeResolver.resolveTypeArgument((Class<?>)returnType, genericIfc);
return GenericTypeResolver.resolveTypeArgument((Class<?>) returnType, genericIfc);
}
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2010 the original author or authors.
* Copyright 2002-2011 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.
@ -128,8 +128,8 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem
}
/**
* Set whether to use Spring-based scanning for entity classes in the classpath
* instead of listing annotated classes explicitly.
* Specify packages to search using Spring-based scanning for entity classes in
* the classpath. This is an alternative to listing annotated classes explicitly.
* <p>Default is none. Specify packages to search for autodetection of your entity
* classes in the classpath. This is analogous to Spring's component-scan feature
* ({@link org.springframework.context.annotation.ClassPathBeanDefinitionScanner}).