本文整理匯總了Java中org.springframework.beans.factory.xml.ParserContext.getRegistry方法的典型用法代碼示例。如果您正苦於以下問題:Java ParserContext.getRegistry方法的具體用法?Java ParserContext.getRegistry怎麽用?Java ParserContext.getRegistry使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.beans.factory.xml.ParserContext
的用法示例。
在下文中一共展示了ParserContext.getRegistry方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: generateBeanName
import org.springframework.beans.factory.xml.ParserContext; //導入方法依賴的package包/類
protected String generateBeanName(String prefix, BeanDefinition def, ParserContext parserContext) {
BeanDefinitionRegistry registry = parserContext.getRegistry();
String name = prefix + BeanDefinitionReaderUtils.generateBeanName(def, registry);
String generated = name;
int counter = 0;
while (registry.containsBeanDefinition(generated)) {
generated = name + BeanFactoryUtils.GENERATED_BEAN_NAME_SEPARATOR + counter;
if (parserContext.isNested()) {
generated = generated.concat("#generated");
}
counter++;
}
return generated;
}
示例2: validateServiceReferences
import org.springframework.beans.factory.xml.ParserContext; //導入方法依賴的package包/類
protected void validateServiceReferences(Element element, String serviceId, ParserContext parserContext) {
BeanDefinitionRegistry registry = parserContext.getRegistry();
String[] names = registry.getBeanDefinitionNames();
for (String name : names) {
BeanDefinition definition = registry.getBeanDefinition(name);
Collection<String> exporters =
(Collection<String>) definition.getAttribute(ParserUtils.REFERENCE_LISTENER_REF_ATTR);
if (exporters != null && exporters.contains(serviceId)) {
parserContext.getReaderContext()
.error(
"Service exporter '" + serviceId + "' cannot be used as a reference listener by '"
+ name + "'", element);
}
}
}
示例3: decorate
import org.springframework.beans.factory.xml.ParserContext; //導入方法依賴的package包/類
public BeanDefinitionHolder decorate(Node node, BeanDefinitionHolder definition, ParserContext parserContext)
{
Element element = (Element) node;
String type = element.getAttribute("type");
String className = element.getAttribute("class");
String javascriptClassName = element.getAttribute("javascript");
BeanDefinitionRegistry registry = parserContext.getRegistry();
ConverterConfig converterConfig = new ConverterConfig();
converterConfig.setType(type);
converterConfig.setJavascriptClassName(javascriptClassName);
parseConverterSettings(converterConfig, element);
lookupConverters(registry).put(className, converterConfig);
return definition;
}
示例4: parse
import org.springframework.beans.factory.xml.ParserContext; //導入方法依賴的package包/類
@Override
public BeanDefinition parse(Element element, ParserContext parserContext) {
FieldDefine fieldDefine = parseFieldDefine(element);
String id = fieldDefine.getId();
if (StringUtils.isEmpty(id)) {
id = fieldDefine.toString()+"-"+System.currentTimeMillis();
}
RootBeanDefinition beanDefinition = new RootBeanDefinition();
beanDefinition.setBeanClass(FieldDefine.class);
beanDefinition.setLazyInit(false);
BeanDefinitionRegistry registry = parserContext.getRegistry();
if (registry.containsBeanDefinition(id)) {
throw new IllegalStateException("Duplicate spring bean id " + id);
}
registry.registerBeanDefinition(id, beanDefinition);
MutablePropertyValues propertyValues = beanDefinition.getPropertyValues();
propertyValues.addPropertyValue("id", id);
propertyValues.addPropertyValue("name", fieldDefine.getName());
propertyValues.addPropertyValue("type", fieldDefine.getType());
propertyValues.addPropertyValue("selector", fieldDefine.getSelector());
propertyValues.addPropertyValue("processor", fieldDefine.getProcessor());
propertyValues.addPropertyValue("defines", fieldDefine.getDefines());
return beanDefinition;
}
示例5: parse
import org.springframework.beans.factory.xml.ParserContext; //導入方法依賴的package包/類
public BeanDefinition parse(Element element, ParserContext parserContext) {
BeanDefinitionRegistry registry = parserContext.getRegistry();
registry.registerBeanDefinition("nsDate", BeanDefinitionBuilder.genericBeanDefinition("java.util.Date").getBeanDefinition());
registry.registerBeanDefinition("nsBean", BeanDefinitionBuilder.genericBeanDefinition("java.awt.Rectangle").getBeanDefinition());
return null;
}
示例6: parse
import org.springframework.beans.factory.xml.ParserContext; //導入方法依賴的package包/類
public BeanDefinition parse(Element element, ParserContext parserContext)
{
BeanDefinitionRegistry registry = parserContext.getRegistry();
BeanDefinition beanDefinition = registerSpringConfiguratorIfNecessary(registry);
Element initElement = DomUtils.getChildElementByTagName(element, "init");
if (initElement != null)
{
decorate(initElement, new BeanDefinitionHolder(beanDefinition, DEFAULT_SPRING_CONFIGURATOR_ID), parserContext);
}
List createElements = DomUtils.getChildElementsByTagName(element, "create");
Iterator iter = createElements.iterator();
while (iter.hasNext())
{
Element createElement = (Element) iter.next();
decorate(createElement, new BeanDefinitionHolder(beanDefinition, DEFAULT_SPRING_CONFIGURATOR_ID), parserContext);
}
List convertElements = DomUtils.getChildElementsByTagName(element, "convert");
iter = convertElements.iterator();
while (iter.hasNext())
{
Element convertElement = (Element) iter.next();
decorate(convertElement, new BeanDefinitionHolder(beanDefinition, DEFAULT_SPRING_CONFIGURATOR_ID), parserContext);
}
List signatureElements = DomUtils.getChildElementsByTagName(element, "signatures");
for (Iterator i = signatureElements.iterator(); i.hasNext();)
{
Element signatureElement = (Element) i.next();
decorate(signatureElement, new BeanDefinitionHolder(beanDefinition, DEFAULT_SPRING_CONFIGURATOR_ID), parserContext);
}
return beanDefinition;
}