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


Java NamedBean类代码示例

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


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

示例1: testWithIntroduction

import org.springframework.beans.factory.NamedBean; //导入依赖的package包/类
@Test
public void testWithIntroduction() {
	String beanName = "foo";
	TestBean target = new RequiresBeanNameBoundTestBean(beanName);
	ProxyFactory pf = new ProxyFactory(target);
	pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
	pf.addAdvisor(ExposeBeanNameAdvisors.createAdvisorIntroducingNamedBean(beanName));
	ITestBean proxy = (ITestBean) pf.getProxy();

	assertTrue("Introduction was made", proxy instanceof NamedBean);
	// Requires binding
	proxy.getAge();

	NamedBean nb = (NamedBean) proxy;
	assertEquals("Name returned correctly", beanName, nb.getBeanName());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:17,代码来源:ExposeBeanNameAdvisorsTests.java

示例2: popuateGraph

import org.springframework.beans.factory.NamedBean; //导入依赖的package包/类
public void popuateGraph(String beanName,
		DefaultListableBeanFactory beanFactory, DirectedGraph<String> dg) {
	Object object = beanFactory.getBean(beanName);
	if (object instanceof EventSource) {
		Collection<EventSink> eventSinks = ((EventSource) object)
				.getEventSinks();
		for (EventSink eventSink : eventSinks) {
			if (eventSink != null) {
				boolean isNodeNotExistsed = dg.addNode(eventSink
						.getBeanName());
				dg.addEdge(beanName, eventSink.getBeanName());
				if (isNodeNotExistsed) {
					popuateGraph(eventSink.getBeanName(), beanFactory, dg);
				}
			}
		}
	} else if (object instanceof NamedBean) {
		dg.addNode(beanName);
	} else {
		throw new RuntimeException("should not happen!!");
	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:23,代码来源:DataFlows.java

示例3: processPauseEvent

import org.springframework.beans.factory.NamedBean; //导入依赖的package包/类
/**
 * 
 * @param pauseEvent
 */
public void processPauseEvent(PauseEvent pauseEvent) {
	Object eventSource = pauseEvent.getSource();
	NamedBean bean = (NamedBean) eventSource;
	Collection<EventSink> eventSinks = getEventSinks();
	if (eventSinks != null) {
		for (EventSink eventSink : eventSinks) {
			if (bean.getBeanName()
					.equalsIgnoreCase(eventSink.getBeanName())) {
				removeEventSink(eventSink);
				m_pausedEventSink.add(eventSink);
			}
		}
		if (isEventFromTheSink(getPausedEventSink(), bean.getBeanName())
				&& m_pauseIfAnyEventSinkPauses && !m_isSourcePaused.get()) {
			m_isSourcePaused.set(true);
			pause();
		} else if (isEventFromTheSink(getPausedEventSink(),
				bean.getBeanName())
				&& getEventSinks().size() == 0 && !m_isSourcePaused.get()) {
			m_isSourcePaused.set(true);
			pause();
		}
	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:29,代码来源:AbstractEventSource.java

示例4: testNoIntroduction

import org.springframework.beans.factory.NamedBean; //导入依赖的package包/类
@Test
public void testNoIntroduction() {
	String beanName = "foo";
	TestBean target = new RequiresBeanNameBoundTestBean(beanName);
	ProxyFactory pf = new ProxyFactory(target);
	pf.addAdvisor(ExposeInvocationInterceptor.ADVISOR);
	pf.addAdvisor(ExposeBeanNameAdvisors.createAdvisorWithoutIntroduction(beanName));
	ITestBean proxy = (ITestBean) pf.getProxy();

	assertFalse("No introduction", proxy instanceof NamedBean);
	// Requires binding
	proxy.getAge();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:14,代码来源:ExposeBeanNameAdvisorsTests.java

示例5: processResumeEvent

import org.springframework.beans.factory.NamedBean; //导入依赖的package包/类
/**
 * 
 * @param resumeEvent
 */
public void processResumeEvent(ResumeEvent resumeEvent) {
	Object eventSource = resumeEvent.getSource();
	NamedBean bean = (NamedBean) eventSource;
	List<EventSink> eventSinks = new ArrayList<EventSink>();
	eventSinks
			.addAll(Collections.unmodifiableCollection(m_pausedEventSink));
	if (eventSinks != null) {
		for (EventSink eventSink : eventSinks) {
			if (bean.getBeanName()
					.equalsIgnoreCase(eventSink.getBeanName())) {
				addEventSink(eventSink);
				m_pausedEventSink.remove(eventSink);
			}
		}
		if (isEventFromTheSink(eventSinks, bean.getBeanName())
				&& m_pauseIfAnyEventSinkPauses
				&& getPausedEventSink().size() == 0
				&& m_isSourcePaused.get()) {
			m_isSourcePaused.set(false);
			resume();
		} else if (isEventFromTheSink(eventSinks, bean.getBeanName())
				&& !m_pauseIfAnyEventSinkPauses
				&& getEventSinks().size() > 0 && m_isSourcePaused.get()) {
			m_isSourcePaused.set(false);
			resume();
		}
	}
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:33,代码来源:AbstractEventSource.java

示例6: isChangedBean

import org.springframework.beans.factory.NamedBean; //导入依赖的package包/类
public boolean isChangedBean(NamedBean bean) {
	return bean != null && getBeanName().equals(bean.getBeanName());
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:4,代码来源:EPLBeanRecoveryEvent.java

示例7: isChangedBean

import org.springframework.beans.factory.NamedBean; //导入依赖的package包/类
public boolean isChangedBean(NamedBean bean) {
  return bean != null && getBeanName().equals(bean.getBeanName());
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:4,代码来源:ContextBeanChangedEvent.java

示例8: log

import org.springframework.beans.factory.NamedBean; //导入依赖的package包/类
/**
 * Any caller is required to pass a source Identifier which will be part of the log message. The 
 * implementation of this method must add the event ID to the log message along with the passed source Identifier
 * 
 * @param source
 * @return
 */
public void log(NamedBean source) {
	LOGGER.debug( "eventSource=" + source.getBeanName() + "&eventId = " + getEventId());
}
 
开发者ID:pulsarIO,项目名称:jetstream,代码行数:11,代码来源:JetstreamEvent.java


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