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


Java DependencyDescriptor.getMethodParameter方法代码示例

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


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

示例1: isAutowireCandidate

import org.springframework.beans.factory.config.DependencyDescriptor; //导入方法依赖的package包/类
/**
 * Determine whether the provided bean definition is an autowire candidate.
 * <p>To be considered a candidate the bean's <em>autowire-candidate</em>
 * attribute must not have been set to 'false'. Also, if an annotation on
 * the field or parameter to be autowired is recognized by this bean factory
 * as a <em>qualifier</em>, the bean must 'match' against the annotation as
 * well as any attributes it may contain. The bean definition must contain
 * the same qualifier or match by meta attributes. A "value" attribute will
 * fallback to match against the bean name or an alias if a qualifier or
 * attribute does not match.
 * @see Qualifier
 */
@Override
public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) {
	boolean match = super.isAutowireCandidate(bdHolder, descriptor);
	if (match && descriptor != null) {
		match = checkQualifiers(bdHolder, descriptor.getAnnotations());
		if (match) {
			MethodParameter methodParam = descriptor.getMethodParameter();
			if (methodParam != null) {
				Method method = methodParam.getMethod();
				if (method == null || void.class.equals(method.getReturnType())) {
					match = checkQualifiers(bdHolder, methodParam.getMethodAnnotations());
				}
			}
		}
	}
	return match;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:QualifierAnnotationAutowireCandidateResolver.java

示例2: isAutowireCandidate

import org.springframework.beans.factory.config.DependencyDescriptor; //导入方法依赖的package包/类
/**
 * Determine whether the provided bean definition is an autowire candidate.
 * <p>To be considered a candidate the bean's <em>autowire-candidate</em>
 * attribute must not have been set to 'false'. Also, if an annotation on
 * the field or parameter to be autowired is recognized by this bean factory
 * as a <em>qualifier</em>, the bean must 'match' against the annotation as
 * well as any attributes it may contain. The bean definition must contain
 * the same qualifier or match by meta attributes. A "value" attribute will
 * fallback to match against the bean name or an alias if a qualifier or
 * attribute does not match.
 * @see Qualifier
 */
@Override
public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) {
	boolean match = super.isAutowireCandidate(bdHolder, descriptor);
	if (match && descriptor != null) {
		match = checkQualifiers(bdHolder, descriptor.getAnnotations());
		if (match) {
			MethodParameter methodParam = descriptor.getMethodParameter();
			if (methodParam != null) {
				Method method = methodParam.getMethod();
				if (method == null || void.class == method.getReturnType()) {
					match = checkQualifiers(bdHolder, methodParam.getMethodAnnotations());
				}
			}
		}
	}
	return match;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:30,代码来源:QualifierAnnotationAutowireCandidateResolver.java

示例3: resolveDependency

import org.springframework.beans.factory.config.DependencyDescriptor; //导入方法依赖的package包/类
@Override
public Object resolveDependency(DependencyDescriptor descriptor, String beanName, Set<String> autowiredBeanNames,
                                TypeConverter typeConverter) throws BeansException {
    Field field = descriptor.getField();

    if (field != null && Logger.class == descriptor.getDependencyType()) {
        return LoggerFactory.getLogger(getDeclaringClass(descriptor));
    }

    if (field != null && Config.class.isAssignableFrom(field.getType())) {
        return getConfig(field.getType());
    }
    MethodParameter methodParam = descriptor.getMethodParameter();
    if (methodParam != null && Config.class.isAssignableFrom(methodParam.getParameterType())) {
        return getConfig(methodParam.getParameterType());
    }
    return super.resolveDependency(descriptor, beanName, autowiredBeanNames, typeConverter);
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:19,代码来源:CubaDefaultListableBeanFactory.java

示例4: isAutowireCandidate

import org.springframework.beans.factory.config.DependencyDescriptor; //导入方法依赖的package包/类
/**
 * Determine whether the provided bean definition is an autowire candidate.
 * <p>To be considered a candidate the bean's <em>autowire-candidate</em>
 * attribute must not have been set to 'false'. Also, if an annotation on
 * the field or parameter to be autowired is recognized by this bean factory
 * as a <em>qualifier</em>, the bean must 'match' against the annotation as
 * well as any attributes it may contain. The bean definition must contain
 * the same qualifier or match by meta attributes. A "value" attribute will
 * fallback to match against the bean name or an alias if a qualifier or
 * attribute does not match.
 * @see Qualifier
 */
public boolean isAutowireCandidate(BeanDefinitionHolder bdHolder, DependencyDescriptor descriptor) {
	if (!bdHolder.getBeanDefinition().isAutowireCandidate()) {
		// if explicitly false, do not proceed with qualifier check
		return false;
	}
	if (descriptor == null) {
		// no qualification necessary
		return true;
	}
	boolean match = checkQualifiers(bdHolder, descriptor.getAnnotations());
	if (match) {
		MethodParameter methodParam = descriptor.getMethodParameter();
		if (methodParam != null) {
			Method method = methodParam.getMethod();
			if (method == null || void.class.equals(method.getReturnType())) {
				match = checkQualifiers(bdHolder, methodParam.getMethodAnnotations());
			}
		}
	}
	return match;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:34,代码来源:QualifierAnnotationAutowireCandidateResolver.java

示例5: getSuggestedValue

import org.springframework.beans.factory.config.DependencyDescriptor; //导入方法依赖的package包/类
/**
 * Determine whether the given dependency carries a value annotation.
 * @see Value
 */
@Override
public Object getSuggestedValue(DependencyDescriptor descriptor) {
	Object value = findValue(descriptor.getAnnotations());
	if (value == null) {
		MethodParameter methodParam = descriptor.getMethodParameter();
		if (methodParam != null) {
			value = findValue(methodParam.getMethodAnnotations());
		}
	}
	return value;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:16,代码来源:QualifierAnnotationAutowireCandidateResolver.java

示例6: getDeclaringClass

import org.springframework.beans.factory.config.DependencyDescriptor; //导入方法依赖的package包/类
protected Class<?> getDeclaringClass(DependencyDescriptor descriptor) {
    MethodParameter methodParameter = descriptor.getMethodParameter();
    if (methodParameter != null) {
        return methodParameter.getDeclaringClass();
    }
    Field field = descriptor.getField();
    if (field != null) {
        return field.getDeclaringClass();
    }
    throw new AssertionError("Injection must be into a method parameter or field.");
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:12,代码来源:CubaDefaultListableBeanFactory.java

示例7: getSuggestedValue

import org.springframework.beans.factory.config.DependencyDescriptor; //导入方法依赖的package包/类
/**
 * Determine whether the given dependency carries a value annotation.
 * @see Value
 */
public Object getSuggestedValue(DependencyDescriptor descriptor) {
	Object value = findValue(descriptor.getAnnotations());
	if (value == null) {
		MethodParameter methodParam = descriptor.getMethodParameter();
		if (methodParam != null) {
			value = findValue(methodParam.getMethodAnnotations());
		}
	}
	return value;
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:15,代码来源:QualifierAnnotationAutowireCandidateResolver.java

示例8: getSuggestedValue

import org.springframework.beans.factory.config.DependencyDescriptor; //导入方法依赖的package包/类
@Override
public Object getSuggestedValue(DependencyDescriptor descriptor) {
	Object suggested = null;
	Field field = descriptor.getField();
	MethodParameter methodParameter = descriptor.getMethodParameter();

	boolean isStatefulFSM = false;
	String controllerId = null;
	Type genericFieldType = null;
	String fieldName = null;
	org.statefulj.framework.core.annotations.FSM fsmAnnotation = null;

	// If this is a StatefulFSM, parse out the Annotation and Type information
	//
	if (field != null) {
		if (isStatefulFSM(field)) {
			fsmAnnotation = field.getAnnotation(org.statefulj.framework.core.annotations.FSM.class);
			genericFieldType = field.getGenericType();
			fieldName = field.getName();
			isStatefulFSM = true;
		}
	} else if (methodParameter != null) {
		if (isStatefulFSM(methodParameter)) {
			fsmAnnotation = methodParameter.getParameterAnnotation(org.statefulj.framework.core.annotations.FSM.class);
			genericFieldType = methodParameter.getGenericParameterType();
			fieldName = methodParameter.getParameterName();
			isStatefulFSM = true;
		}
	}

	// If this is a StatefulFSM field, then resolve bean reference
	//
	if (isStatefulFSM) {

		// Determine the controllerId - either explicit or derived
		//
		controllerId = getControllerId(fsmAnnotation);
		if (StringUtils.isEmpty(controllerId)) {

			// Get the Managed Class
			//
			Class<?> managedClass = getManagedClass(fieldName, genericFieldType);

			// Fetch the Controller from the mapping
			//
			controllerId = deriveControllerId(fieldName, managedClass);
		}

		ReferenceFactory refFactory = new ReferenceFactoryImpl(controllerId);
		suggested = appContext.getBean(refFactory.getStatefulFSMId());
	}


	return (suggested != null) ? suggested : super.getSuggestedValue(descriptor);
}
 
开发者ID:statefulj,项目名称:statefulj,代码行数:56,代码来源:StatefulFactory.java


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