本文整理汇总了Java中org.springframework.beans.factory.parsing.ComponentDefinition类的典型用法代码示例。如果您正苦于以下问题:Java ComponentDefinition类的具体用法?Java ComponentDefinition怎么用?Java ComponentDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentDefinition类属于org.springframework.beans.factory.parsing包,在下文中一共展示了ComponentDefinition类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testPointcutEvents
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
@Test
public void testPointcutEvents() throws Exception {
this.reader.loadBeanDefinitions(POINTCUT_EVENTS_CONTEXT);
ComponentDefinition[] componentDefinitions = this.eventListener.getComponentDefinitions();
assertEquals("Incorrect number of events fired", 1, componentDefinitions.length);
assertTrue("No holder with nested components", componentDefinitions[0] instanceof CompositeComponentDefinition);
CompositeComponentDefinition compositeDef = (CompositeComponentDefinition) componentDefinitions[0];
assertEquals("aop:config", compositeDef.getName());
ComponentDefinition[] nestedComponentDefs = compositeDef.getNestedComponents();
assertEquals("Incorrect number of inner components", 2, nestedComponentDefs.length);
PointcutComponentDefinition pcd = null;
for (int i = 0; i < nestedComponentDefs.length; i++) {
ComponentDefinition componentDefinition = nestedComponentDefs[i];
if (componentDefinition instanceof PointcutComponentDefinition) {
pcd = (PointcutComponentDefinition) componentDefinition;
break;
}
}
assertNotNull("PointcutComponentDefinition not found", pcd);
assertEquals("Incorrect number of BeanDefinitions", 1, pcd.getBeanDefinitions().length);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:AopNamespaceHandlerEventTests.java
示例2: containsComponentDefinition
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
public boolean containsComponentDefinition(String name) {
for (ComponentDefinition cd : this.registeredComponents) {
if (cd instanceof CompositeComponentDefinition) {
ComponentDefinition[] innerCds = ((CompositeComponentDefinition) cd).getNestedComponents();
for (ComponentDefinition innerCd : innerCds) {
if (innerCd.getName().equals(name)) {
return true;
}
}
}
else {
if (cd.getName().equals(name)) {
return true;
}
}
}
return false;
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:19,代码来源:JmsNamespaceHandlerTests.java
示例3: registerDefaultTableActions
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
/**
* Register default TablePanel Actions
* @param element current element
* @param parserContext parserContext
* @return a new ComponentDefinition with default table action list.
*/
private ComponentDefinition registerDefaultTableActions(Element element, ParserContext parserContext) {
ManagedList<Object> actions = new ManagedList<Object>(7);
actions.add(createBeanDefinition(AddAction.class, parserContext));
actions.add(createBeanDefinition(RefreshAction.class, parserContext));
actions.add(createBeanDefinition(RemoveAction.class, parserContext));
actions.add(createBeanDefinition(FindAction.class, parserContext));
actions.add(createBeanDefinition(ClearFilterAction.class, parserContext));
BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(ListFactoryBean.class);
bdb.getRawBeanDefinition().setSource(parserContext.extractSource(element));
bdb.addPropertyValue("sourceList", actions);
bdb.setScope(BeanDefinition.SCOPE_PROTOTYPE);
BeanComponentDefinition bcd = new BeanComponentDefinition(bdb.getBeanDefinition(),
DEFAULT_TABLE_ACTIONS);
registerBeanComponentDefinition(element, parserContext, bcd);
return bcd;
}
开发者ID:chelu,项目名称:jdal,代码行数:24,代码来源:DefaultsBeanDefinitionParser.java
示例4: registerAccessorFactory
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
/**
* @return
*/
private ComponentDefinition registerAccessorFactory(Element element, ParserContext parserContext) {
BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(
ConfigurableControlAccessorFactory.class);
Map<Class<?>, Class<?extends ControlAccessor>> accessors =
new ManagedMap<Class<?>,Class<?extends ControlAccessor>>();
accessors.put(JTextComponent.class, TextComponentAccessor.class);
accessors.put(JList.class, ListAccessor.class);
accessors.put(Selector.class, SelectorAccessor.class);
accessors.put(JToggleButton.class, ToggleButtonAccessor.class);
accessors.put(JComboBox.class, ComboAccessor.class);
accessors.put(View.class, ViewAccessor.class);
accessors.put(JLabel.class, LabelAccessor.class);
accessors.put(TablePanel.class, TablePanelAccessor.class);
bdb.addPropertyValue("accessors", accessors);
BeanComponentDefinition bcd = new BeanComponentDefinition(bdb.getBeanDefinition(), ACCESSOR_FACTORY_BEAN_NAME);
registerBeanComponentDefinition(element, parserContext, bcd);
return bcd;
}
开发者ID:chelu,项目名称:jdal,代码行数:25,代码来源:DefaultsBeanDefinitionParser.java
示例5: registerDefaultTableActions
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
/**
* Register default TablePanel Actions
* @param element current element
* @param parserContext parserContext
* @return a new ComponentDefinition with default table action list.
*/
private ComponentDefinition registerDefaultTableActions(Element element, ParserContext parserContext) {
ManagedList<Object> actions = new ManagedList<Object>(7);
actions.add(createBeanDefinition(AddAction.class, parserContext));
actions.add(createBeanDefinition(SelectAllAction.class, parserContext));
actions.add(createBeanDefinition(DeselectAllAction.class, parserContext));
actions.add(createBeanDefinition(RemoveAllAction.class, parserContext));
actions.add(createBeanDefinition(HideShowFilterAction.class, parserContext));
actions.add(createBeanDefinition(ApplyFilterAction.class, parserContext));
actions.add(createBeanDefinition(ClearFilterAction.class, parserContext));
BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(ListFactoryBean.class);
bdb.getRawBeanDefinition().setSource(parserContext.extractSource(element));
bdb.addPropertyValue("sourceList", actions);
bdb.setScope(BeanDefinition.SCOPE_PROTOTYPE);
BeanComponentDefinition bcd = new BeanComponentDefinition(bdb.getBeanDefinition(),
DEFAULT_TABLE_ACTIONS);
registerBeanComponentDefinition(element, parserContext, bcd);
return bcd;
}
开发者ID:chelu,项目名称:jdal,代码行数:26,代码来源:DefaultsBeanDefinitionParser.java
示例6: componentRegistered
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
public void componentRegistered(
ComponentDefinition paramComponentDefinition) {
String name = paramComponentDefinition.getName();
for(BeanDefinition bd : paramComponentDefinition.getBeanDefinitions()) {
processBeanDefinition(name, bd);
}
}
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:9,代码来源:ContextDependencyLister.java
示例7: registerComponent
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
public void registerComponent(ComponentDefinition component) {
CompositeComponentDefinition containingComponent = getContainingComponent();
if (containingComponent != null) {
containingComponent.addNestedComponent(component);
}
else {
this.readerContext.fireComponentRegistered(component);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:ParserContext.java
示例8: testAdvisorEventsWithPointcutRef
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
@Test
public void testAdvisorEventsWithPointcutRef() throws Exception {
this.reader.loadBeanDefinitions(POINTCUT_REF_CONTEXT);
ComponentDefinition[] componentDefinitions = this.eventListener.getComponentDefinitions();
assertEquals("Incorrect number of events fired", 2, componentDefinitions.length);
assertTrue("No holder with nested components", componentDefinitions[0] instanceof CompositeComponentDefinition);
CompositeComponentDefinition compositeDef = (CompositeComponentDefinition) componentDefinitions[0];
assertEquals("aop:config", compositeDef.getName());
ComponentDefinition[] nestedComponentDefs = compositeDef.getNestedComponents();
assertEquals("Incorrect number of inner components", 3, nestedComponentDefs.length);
AdvisorComponentDefinition acd = null;
for (int i = 0; i < nestedComponentDefs.length; i++) {
ComponentDefinition componentDefinition = nestedComponentDefs[i];
if (componentDefinition instanceof AdvisorComponentDefinition) {
acd = (AdvisorComponentDefinition) componentDefinition;
break;
}
}
assertNotNull("AdvisorComponentDefinition not found", acd);
assertEquals(1, acd.getBeanDefinitions().length);
assertEquals(2, acd.getBeanReferences().length);
assertTrue("No advice bean found", componentDefinitions[1] instanceof BeanComponentDefinition);
BeanComponentDefinition adviceDef = (BeanComponentDefinition) componentDefinitions[1];
assertEquals("countingAdvice", adviceDef.getBeanName());
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:29,代码来源:AopNamespaceHandlerEventTests.java
示例9: testAdvisorEventsWithDirectPointcut
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
@Test
public void testAdvisorEventsWithDirectPointcut() throws Exception {
this.reader.loadBeanDefinitions(DIRECT_POINTCUT_EVENTS_CONTEXT);
ComponentDefinition[] componentDefinitions = this.eventListener.getComponentDefinitions();
assertEquals("Incorrect number of events fired", 2, componentDefinitions.length);
assertTrue("No holder with nested components", componentDefinitions[0] instanceof CompositeComponentDefinition);
CompositeComponentDefinition compositeDef = (CompositeComponentDefinition) componentDefinitions[0];
assertEquals("aop:config", compositeDef.getName());
ComponentDefinition[] nestedComponentDefs = compositeDef.getNestedComponents();
assertEquals("Incorrect number of inner components", 2, nestedComponentDefs.length);
AdvisorComponentDefinition acd = null;
for (int i = 0; i < nestedComponentDefs.length; i++) {
ComponentDefinition componentDefinition = nestedComponentDefs[i];
if (componentDefinition instanceof AdvisorComponentDefinition) {
acd = (AdvisorComponentDefinition) componentDefinition;
break;
}
}
assertNotNull("AdvisorComponentDefinition not found", acd);
assertEquals(2, acd.getBeanDefinitions().length);
assertEquals(1, acd.getBeanReferences().length);
assertTrue("No advice bean found", componentDefinitions[1] instanceof BeanComponentDefinition);
BeanComponentDefinition adviceDef = (BeanComponentDefinition) componentDefinitions[1];
assertEquals("countingAdvice", adviceDef.getBeanName());
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:29,代码来源:AopNamespaceHandlerEventTests.java
示例10: testSourceExtraction
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
@Test
public void testSourceExtraction() {
Iterator<ComponentDefinition> iterator = context.getRegisteredComponents();
while (iterator.hasNext()) {
ComponentDefinition compDef = iterator.next();
assertNotNull("CompositeComponentDefinition '" + compDef.getName() + "' has no source attachment", compDef.getSource());
validateComponentDefinition(compDef);
}
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:JmsNamespaceHandlerTests.java
示例11: beanEventReceived
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
@Test
public void beanEventReceived() throws Exception {
ComponentDefinition componentDefinition1 = this.eventListener.getComponentDefinition("testBean");
assertTrue(componentDefinition1 instanceof BeanComponentDefinition);
assertEquals(1, componentDefinition1.getBeanDefinitions().length);
BeanDefinition beanDefinition1 = componentDefinition1.getBeanDefinitions()[0];
assertEquals(new TypedStringValue("Rob Harrop"),
beanDefinition1.getConstructorArgumentValues().getGenericArgumentValue(String.class).getValue());
assertEquals(1, componentDefinition1.getBeanReferences().length);
assertEquals("testBean2", componentDefinition1.getBeanReferences()[0].getBeanName());
assertEquals(1, componentDefinition1.getInnerBeanDefinitions().length);
BeanDefinition innerBd1 = componentDefinition1.getInnerBeanDefinitions()[0];
assertEquals(new TypedStringValue("ACME"),
innerBd1.getConstructorArgumentValues().getGenericArgumentValue(String.class).getValue());
assertTrue(componentDefinition1.getSource() instanceof Element);
ComponentDefinition componentDefinition2 = this.eventListener.getComponentDefinition("testBean2");
assertTrue(componentDefinition2 instanceof BeanComponentDefinition);
assertEquals(1, componentDefinition1.getBeanDefinitions().length);
BeanDefinition beanDefinition2 = componentDefinition2.getBeanDefinitions()[0];
assertEquals(new TypedStringValue("Juergen Hoeller"),
beanDefinition2.getPropertyValues().getPropertyValue("name").getValue());
assertEquals(0, componentDefinition2.getBeanReferences().length);
assertEquals(1, componentDefinition2.getInnerBeanDefinitions().length);
BeanDefinition innerBd2 = componentDefinition2.getInnerBeanDefinitions()[0];
assertEquals(new TypedStringValue("Eva Schallmeiner"),
innerBd2.getPropertyValues().getPropertyValue("name").getValue());
assertTrue(componentDefinition2.getSource() instanceof Element);
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:30,代码来源:EventPublicationTests.java
示例12: testEvents
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
@Test
public void testEvents() {
ComponentDefinition propertiesComponent = this.listener.getComponentDefinition("myProperties");
assertNotNull("Event for 'myProperties' not sent", propertiesComponent);
AbstractBeanDefinition propertiesBean = (AbstractBeanDefinition) propertiesComponent.getBeanDefinitions()[0];
assertEquals("Incorrect BeanDefinition", PropertiesFactoryBean.class, propertiesBean.getBeanClass());
ComponentDefinition constantComponent = this.listener.getComponentDefinition("min");
assertNotNull("Event for 'min' not sent", propertiesComponent);
AbstractBeanDefinition constantBean = (AbstractBeanDefinition) constantComponent.getBeanDefinitions()[0];
assertEquals("Incorrect BeanDefinition", FieldRetrievingFactoryBean.class, constantBean.getBeanClass());
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:UtilNamespaceHandlerTests.java
示例13: testSourceExtraction
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
@Test
public void testSourceExtraction() {
Iterator iterator = context.getRegisteredComponents();
while (iterator.hasNext()) {
ComponentDefinition compDef = (ComponentDefinition) iterator.next();
assertNotNull("CompositeComponentDefinition '" + compDef.getName()+ "' has no source attachment", compDef.getSource());
validateComponentDefinition(compDef);
}
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:10,代码来源:JmsNamespaceHandlerTests.java
示例14: testBeanEventReceived
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
public void testBeanEventReceived() throws Exception {
ComponentDefinition componentDefinition1 = this.eventListener.getComponentDefinition("testBean");
assertTrue(componentDefinition1 instanceof BeanComponentDefinition);
assertEquals(1, componentDefinition1.getBeanDefinitions().length);
BeanDefinition beanDefinition1 = componentDefinition1.getBeanDefinitions()[0];
assertEquals(new TypedStringValue("Rob Harrop"),
beanDefinition1.getConstructorArgumentValues().getGenericArgumentValue(String.class).getValue());
assertEquals(1, componentDefinition1.getBeanReferences().length);
assertEquals("testBean2", componentDefinition1.getBeanReferences()[0].getBeanName());
assertEquals(1, componentDefinition1.getInnerBeanDefinitions().length);
BeanDefinition innerBd1 = componentDefinition1.getInnerBeanDefinitions()[0];
assertEquals(new TypedStringValue("ACME"),
innerBd1.getConstructorArgumentValues().getGenericArgumentValue(String.class).getValue());
assertTrue(componentDefinition1.getSource() instanceof Element);
ComponentDefinition componentDefinition2 = this.eventListener.getComponentDefinition("testBean2");
assertTrue(componentDefinition2 instanceof BeanComponentDefinition);
assertEquals(1, componentDefinition1.getBeanDefinitions().length);
BeanDefinition beanDefinition2 = componentDefinition2.getBeanDefinitions()[0];
assertEquals(new TypedStringValue("Juergen Hoeller"),
beanDefinition2.getPropertyValues().getPropertyValue("name").getValue());
assertEquals(0, componentDefinition2.getBeanReferences().length);
assertEquals(1, componentDefinition2.getInnerBeanDefinitions().length);
BeanDefinition innerBd2 = componentDefinition2.getInnerBeanDefinitions()[0];
assertEquals(new TypedStringValue("Eva Schallmeiner"),
innerBd2.getPropertyValues().getPropertyValue("name").getValue());
assertTrue(componentDefinition2.getSource() instanceof Element);
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:29,代码来源:EventPublicationTests.java
示例15: testEvents
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
public void testEvents() throws Exception {
ComponentDefinition propertiesComponent = this.listener.getComponentDefinition("myProperties");
assertNotNull("Event for 'myProperties' not sent", propertiesComponent);
AbstractBeanDefinition propertiesBean = (AbstractBeanDefinition) propertiesComponent.getBeanDefinitions()[0];
assertEquals("Incorrect BeanDefinition", PropertiesFactoryBean.class, propertiesBean.getBeanClass());
ComponentDefinition constantComponent = this.listener.getComponentDefinition("min");
assertNotNull("Event for 'min' not sent", propertiesComponent);
AbstractBeanDefinition constantBean = (AbstractBeanDefinition) constantComponent.getBeanDefinitions()[0];
assertEquals("Incorrect BeanDefinition", FieldRetrievingFactoryBean.class, constantBean.getBeanClass());
}
开发者ID:deathspeeder,项目名称:class-guard,代码行数:12,代码来源:UtilNamespaceHandlerTests.java
示例16: componentRegistered
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
@Override
public void componentRegistered(ComponentDefinition componentDefinition) {
log.info("Registered component [" + componentDefinition.getName() + "]");
for (BeanDefinition bd : componentDefinition.getBeanDefinitions()) {
String name = bd.getBeanClassName();
if (bd instanceof BeanComponentDefinition) {
name = ((BeanComponentDefinition) bd).getBeanName();
}
log.info("Registered bean definition: [" + name + "]" + " from " + bd.getResourceDescription());
}
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:12,代码来源:LoggingContextLoader.java
示例17: registerPaginatorView
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
/**
* @return
*/
private ComponentDefinition registerPaginatorView(Element element, ParserContext parserContext) {
BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(VaadinPaginator.class);
bdb.addPropertyValue("pageSizes", "10,20,30,40,50,100,All");
bdb.setScope(BeanDefinition.SCOPE_PROTOTYPE);
BeanComponentDefinition bcd = new BeanComponentDefinition(bdb.getBeanDefinition(), PAGINATOR_VIEW_BEAN_NAME);
registerBeanComponentDefinition(element, parserContext, bcd);
return bcd;
}
开发者ID:chelu,项目名称:jdal,代码行数:12,代码来源:DefaultsBeanDefinitionParser.java
示例18: registerPropertyEditors
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
/**
* Register default CustomEditorConfigurer
* @return default CustomEditorComfigurer ComponentDefinition
*/
private ComponentDefinition registerPropertyEditors(Element element, ParserContext parserContext) {
BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(
CustomEditorConfigurer.class);
Map<String, String> map = new HashMap<String, String>();
map.put("com.vaadin.server.Resource", "org.jdal.vaadin.beans.VaadinResourcePropertyEditor");
bdb.addPropertyValue("customEditors", map);
BeanComponentDefinition bcd = new BeanComponentDefinition(bdb.getBeanDefinition(),
CUSTOM_EDITOR_CONFIGURER_BEAN_NAME);
registerBeanComponentDefinition(element, parserContext, bcd);
return bcd;
}
开发者ID:chelu,项目名称:jdal,代码行数:16,代码来源:DefaultsBeanDefinitionParser.java
示例19: registerDefaultGuiFactory
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
/**
* @param element
* @param parserContext
* @return
*/
private ComponentDefinition registerDefaultGuiFactory(Element element, ParserContext parserContext) {
BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(
ApplicationContextGuiFactory.class);
BeanComponentDefinition bcd = new BeanComponentDefinition(bdb.getBeanDefinition(),
DEFAULT_GUI_FACTORY);
registerBeanComponentDefinition(element, parserContext, bcd);
return bcd;
}
开发者ID:chelu,项目名称:jdal,代码行数:14,代码来源:DefaultsBeanDefinitionParser.java
示例20: registerCollectionTableCellRenderer
import org.springframework.beans.factory.parsing.ComponentDefinition; //导入依赖的package包/类
/**
* Register CollectionTableCellRenderer
* @param element
* @param parserContext
* @return
*/
private ComponentDefinition registerCollectionTableCellRenderer(Element element, ParserContext parserContext) {
BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(CollectionTableCellRenderer.class);
bdb.setScope(BeanDefinition.SCOPE_PROTOTYPE);
BeanComponentDefinition bcd = new BeanComponentDefinition(bdb.getBeanDefinition(), COLLECTION_TABLE_CELL_RENDERER_BEAN_NAME);
registerBeanComponentDefinition(element, parserContext, bcd);
return bcd;
}
开发者ID:chelu,项目名称:jdal,代码行数:14,代码来源:DefaultsBeanDefinitionParser.java
注:本文中的org.springframework.beans.factory.parsing.ComponentDefinition类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论