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


Java ResolvableType.getRawClass方法代码示例

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


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

示例1: 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

示例2: supportsEventType

import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
@Override
@SuppressWarnings("unchecked")
public boolean supportsEventType(ResolvableType eventType) {
	if (this.delegate instanceof SmartApplicationListener) {
		Class<? extends ApplicationEvent> eventClass = (Class<? extends ApplicationEvent>) eventType.getRawClass();
		return ((SmartApplicationListener) this.delegate).supportsEventType(eventClass);
	}
	else {
		return (this.declaredEventType == null || this.declaredEventType.isAssignableFrom(eventType));
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:GenericApplicationListenerAdapter.java

示例3: supportsEventType

import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
@Override
public boolean supportsEventType(ResolvableType resolvableType) {
	Class<?> type = resolvableType.getRawClass();
	if (type == null) {
		return false;
	}
	return ApplicationEnvironmentPreparedEvent.class.isAssignableFrom(type)
			|| ApplicationFailedEvent.class.isAssignableFrom(type);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:ClasspathLoggingApplicationListener.java

示例4: supportsEventType

import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
@Override
public boolean supportsEventType(ResolvableType resolvableType) {
	Class<?> type = resolvableType.getRawClass();
	if (type == null) {
		return false;
	}
	return ContextRefreshedEvent.class.isAssignableFrom(type)
			|| ApplicationFailedEvent.class.isAssignableFrom(type);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:10,代码来源:AutoConfigurationReportLoggingInitializer.java

示例5: isTypeMatch

import org.springframework.core.ResolvableType; //导入方法依赖的package包/类
@Override
public boolean isTypeMatch(String name, ResolvableType typeToMatch) throws NoSuchBeanDefinitionException {
	String beanName = transformedBeanName(name);

	// Check manually registered singletons.
	Object beanInstance = getSingleton(beanName, false);
	if (beanInstance != null) {
		if (beanInstance instanceof FactoryBean) {
			if (!BeanFactoryUtils.isFactoryDereference(name)) {
				Class<?> type = getTypeForFactoryBean((FactoryBean<?>) beanInstance);
				return (type != null && typeToMatch.isAssignableFrom(type));
			}
			else {
				return typeToMatch.isInstance(beanInstance);
			}
		}
		else {
			return (!BeanFactoryUtils.isFactoryDereference(name) && typeToMatch.isInstance(beanInstance));
		}
	}
	else if (containsSingleton(beanName) && !containsBeanDefinition(beanName)) {
		// null instance registered
		return false;
	}

	else {
		// No singleton instance found -> check bean definition.
		BeanFactory parentBeanFactory = getParentBeanFactory();
		if (parentBeanFactory != null && !containsBeanDefinition(beanName)) {
			// No bean definition found in this factory -> delegate to parent.
			return parentBeanFactory.isTypeMatch(originalBeanName(name), typeToMatch);
		}

		// Retrieve corresponding bean definition.
		RootBeanDefinition mbd = getMergedLocalBeanDefinition(beanName);

		Class<?> classToMatch = typeToMatch.getRawClass();
		Class<?>[] typesToMatch = (FactoryBean.class == classToMatch ?
				new Class<?>[] {classToMatch} : new Class<?>[] {FactoryBean.class, classToMatch});

		// Check decorated bean definition, if any: We assume it'll be easier
		// to determine the decorated bean's type than the proxy's type.
		BeanDefinitionHolder dbd = mbd.getDecoratedDefinition();
		if (dbd != null && !BeanFactoryUtils.isFactoryDereference(name)) {
			RootBeanDefinition tbd = getMergedBeanDefinition(dbd.getBeanName(), dbd.getBeanDefinition(), mbd);
			Class<?> targetClass = predictBeanType(dbd.getBeanName(), tbd, typesToMatch);
			if (targetClass != null && !FactoryBean.class.isAssignableFrom(targetClass)) {
				return typeToMatch.isAssignableFrom(targetClass);
			}
		}

		Class<?> beanType = predictBeanType(beanName, mbd, typesToMatch);
		if (beanType == null) {
			return false;
		}

		// Check bean class whether we're dealing with a FactoryBean.
		if (FactoryBean.class.isAssignableFrom(beanType)) {
			if (!BeanFactoryUtils.isFactoryDereference(name)) {
				// If it's a FactoryBean, we want to look at what it creates, not the factory class.
				beanType = getTypeForFactoryBean(beanName, mbd);
				if (beanType == null) {
					return false;
				}
			}
		}
		else if (BeanFactoryUtils.isFactoryDereference(name)) {
			// Special case: A SmartInstantiationAwareBeanPostProcessor returned a non-FactoryBean
			// type but we nevertheless are being asked to dereference a FactoryBean...
			// Let's check the original bean class and proceed with it if it is a FactoryBean.
			beanType = predictBeanType(beanName, mbd, FactoryBean.class);
			if (beanType == null || !FactoryBean.class.isAssignableFrom(beanType)) {
				return false;
			}
		}

		return typeToMatch.isAssignableFrom(beanType);
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:80,代码来源:AbstractBeanFactory.java


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