本文整理匯總了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;
}