本文整理汇总了Java中org.springframework.core.ResolvableType.hasGenerics方法的典型用法代码示例。如果您正苦于以下问题:Java ResolvableType.hasGenerics方法的具体用法?Java ResolvableType.hasGenerics怎么用?Java ResolvableType.hasGenerics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.core.ResolvableType
的用法示例。
在下文中一共展示了ResolvableType.hasGenerics方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveVariable
import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
private static ResolvableType resolveVariable(TypeVariable<?> typeVariable, ResolvableType contextType) {
ResolvableType resolvedType;
if (contextType.hasGenerics()) {
resolvedType = ResolvableType.forType(typeVariable, contextType);
if (resolvedType.resolve() != null) {
return resolvedType;
}
}
ResolvableType superType = contextType.getSuperType();
if (superType != ResolvableType.NONE) {
resolvedType = resolveVariable(typeVariable, superType);
if (resolvedType.resolve() != null) {
return resolvedType;
}
}
for (ResolvableType ifc : contextType.getInterfaces()) {
resolvedType = resolveVariable(typeVariable, ifc);
if (resolvedType.resolve() != null) {
return resolvedType;
}
}
return ResolvableType.NONE;
}
示例2: configureBeanGrid
import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
@Bean
@Scope(scopeName = "prototype")
@SuppressWarnings("unchecked")
public <ITEM> Grid<ITEM> configureBeanGrid(DependencyDescriptor dependencyDescriptor) {
logger.debug("Configuring Vaadin Grid as bean");
long timestamp = System.currentTimeMillis();
ResolvableType injectionPointType = dependencyDescriptor.getResolvableType();
if (!injectionPointType.hasGenerics()) {
throw new IllegalStateException("Grid injection point is expected to declare a static item type");
}
ResolvableType genericType = injectionPointType.getGeneric();
Class<ITEM> itemType = (Class<ITEM>) genericType.resolve();
logger.debug("Vaadin Grid will use " + itemType.getCanonicalName() + " as item type");
Grid<ITEM> grid = configureGridInstance(itemType);
long configTime = System.currentTimeMillis() - timestamp;
logger.debug("Done configuring Grid for " + itemType.getName() + " in " + configTime + "ms");
return grid;
}
示例3: getType
import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
/**
*
* @param rt
* @return
*/
protected static Type getType(final ResolvableType rt) {
if (!rt.hasGenerics()) {
return rt.resolve();
} else {
return new ParameterizedType() {
public Type[] getActualTypeArguments() {
Type[] ret = new Type[rt.getGenerics().length];
for (int i = 0; i < ret.length; i++) {
ret[i] = getType(rt.getGenerics()[i]);
}
return ret;
}
public Type getRawType() {
return rt.resolve();
}
public Type getOwnerType() {
return null;
}
};
}
}
示例4: getActualType
import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
public ResolvableType getActualType(ResolvableType original){
if(!original.hasGenerics()){
return original;
}else{
return original.getGeneric(0);
}
}
示例5: resolveDeclaredEventType
import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
static ResolvableType resolveDeclaredEventType(Class<?> listenerType) {
ResolvableType resolvableType = ResolvableType.forClass(listenerType).as(ApplicationListener.class);
if (resolvableType == null || !resolvableType.hasGenerics()) {
return null;
}
return resolvableType.getGeneric();
}