本文整理汇总了Java中org.springframework.beans.factory.config.BeanDefinition.hasAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java BeanDefinition.hasAttribute方法的具体用法?Java BeanDefinition.hasAttribute怎么用?Java BeanDefinition.hasAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.factory.config.BeanDefinition
的用法示例。
在下文中一共展示了BeanDefinition.hasAttribute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildComponentMetadataFor
import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
public static List<ComponentMetadata> buildComponentMetadataFor(ConfigurableListableBeanFactory factory) {
List<ComponentMetadata> metadata = new ArrayList<ComponentMetadata>();
String[] components = factory.getBeanDefinitionNames();
for (String beanName : components) {
BeanDefinition definition = factory.getBeanDefinition(beanName);
// filter generated definitions
if (!definition.hasAttribute(PROMOTED_REF)) {
// add metadata for top-level definitions
metadata.add(MetadataFactory.buildComponentMetadataFor(beanName, definition));
// look for nested ones
metadata.addAll(MetadataFactory.buildNestedComponentMetadataFor(definition));
}
}
return metadata;
}
示例2: SimpleBeanMetadata
import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
/**
* Constructs a new <code>SpringLocalComponentMetadata</code> instance.
*
* @param name bean name
* @param definition Spring bean definition
*/
public SimpleBeanMetadata(String name, BeanDefinition definition) {
super(name, definition);
final String factoryMtd = definition.getFactoryMethodName();
if (StringUtils.hasText(factoryMtd)) {
factoryMethod = factoryMtd;
String factory = definition.getFactoryBeanName();
if (StringUtils.hasText(factory)) {
factoryComponent = new SimpleRefMetadata(factory);
} else {
factoryComponent = null;
}
} else {
factoryComponent = null;
factoryMethod = null;
}
arguments = MetadataUtils.getBeanArguments(definition);
properties = MetadataUtils.getBeanProperties(definition);
// double check if the definition had "scope" declared
boolean hasAttribute = definition.hasAttribute(BlueprintParser.DECLARED_SCOPE);
scope = (hasAttribute ? (StringUtils.hasText(name) ? beanDefinition.getScope() : null) : null);
}
示例3: postProcessBeanFactory
import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
boolean trace = log.isTraceEnabled();
String[] names = beanFactory.getBeanDefinitionNames();
for (String name : names) {
BeanDefinition definition = beanFactory.getBeanDefinition(name);
if (definition.hasAttribute(ParsingUtils.BLUEPRINT_MARKER_NAME)) {
ConstructorArgumentValues cArgs = definition.getConstructorArgumentValues();
if (trace)
log.trace("Inspecting cycles for (blueprint) bean " + name);
tag(cArgs.getGenericArgumentValues(), name, definition);
tag(cArgs.getIndexedArgumentValues().values(), name, definition);
}
}
}
示例4: getConfigurationClassFactoryBeanGeneric
import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
private Class<?> getConfigurationClassFactoryBeanGeneric(ConfigurableListableBeanFactory beanFactory,
BeanDefinition definition, String name) throws Exception {
Method method = getFactoryMethod(beanFactory, definition);
Class<?> generic = ResolvableType.forMethodReturnType(method).as(FactoryBean.class).resolveGeneric();
if ((generic == null || generic.equals(Object.class))
&& definition.hasAttribute(FACTORY_BEAN_OBJECT_TYPE)) {
generic = getTypeFromAttribute(definition.getAttribute(FACTORY_BEAN_OBJECT_TYPE));
}
return generic;
}
示例5: getDirectFactoryBeanGeneric
import org.springframework.beans.factory.config.BeanDefinition; //导入方法依赖的package包/类
private Class<?> getDirectFactoryBeanGeneric(
ConfigurableListableBeanFactory beanFactory, BeanDefinition definition,
String name) throws ClassNotFoundException, LinkageError {
Class<?> factoryBeanClass = ClassUtils.forName(definition.getBeanClassName(), beanFactory.getBeanClassLoader());
Class<?> generic = ResolvableType.forClass(factoryBeanClass).as(FactoryBean.class).resolveGeneric();
if ((generic == null || generic.equals(Object.class))
&& definition.hasAttribute(FACTORY_BEAN_OBJECT_TYPE)) {
generic = getTypeFromAttribute(definition.getAttribute(FACTORY_BEAN_OBJECT_TYPE));
}
return generic;
}