当前位置: 首页>>代码示例>>Java>>正文


Java ResolvableType.getGeneric方法代码示例

本文整理汇总了Java中org.springframework.core.ResolvableType.getGeneric方法的典型用法代码示例。如果您正苦于以下问题:Java ResolvableType.getGeneric方法的具体用法?Java ResolvableType.getGeneric怎么用?Java ResolvableType.getGeneric使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.core.ResolvableType的用法示例。


在下文中一共展示了ResolvableType.getGeneric方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
}
 
开发者ID:peterl1084,项目名称:bean-grid,代码行数:25,代码来源:BeanGridConfiguration.java

示例2: getFieldType

import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
protected static Class<?> getFieldType(java.lang.reflect.Field field) {

		ResolvableType resolvableType = ResolvableType.forField(field);

		if (resolvableType.isArray()) {
			return resolvableType.getComponentType().getRawClass();
		}

		ResolvableType componentType = resolvableType.getGeneric(0);
		if (Iterable.class.isAssignableFrom(field.getType())
				&& componentType != ResolvableType.NONE) {
			return componentType.getRawClass();
		}

		return resolvableType.getRawClass();
	}
 
开发者ID:VanRoy,项目名称:spring-data-jest,代码行数:17,代码来源:MappingBuilder.java

示例3: getActualType

import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
public ResolvableType getActualType(ResolvableType original){
	if(!original.hasGenerics()){
		return  original;
	}else{
		return original.getGeneric(0);
	}
}
 
开发者ID:viniciusccarvalho,项目名称:spring-cloud-sockets,代码行数:8,代码来源:AbstractConverter.java

示例4: 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();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:GenericApplicationListenerAdapter.java

示例5: isValueCSVDatabaseIndexes

import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
/**
 * Is value a comma separated value of database indexes
 *
 * @param type the type of the value
 * @return boolean
 */
private Boolean isValueCSVDatabaseIndexes(final ResolvableType type) {
    return java.util.Collection.class.isAssignableFrom(type.getRawClass()) &&
            (type.getGeneric(0) != null) &&
            (type.getGeneric(0).getRawClass().getAnnotation(SchemaRepository.class) != null);
}
 
开发者ID:mhaddon,项目名称:Sound.je,代码行数:12,代码来源:FormParse.java


注:本文中的org.springframework.core.ResolvableType.getGeneric方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。