本文整理汇总了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());
}
示例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!!");
}
}
示例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();
}
}
}
示例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();
}
示例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();
}
}
}
示例6: isChangedBean
import org.springframework.beans.factory.NamedBean; //导入依赖的package包/类
public boolean isChangedBean(NamedBean bean) {
return bean != null && getBeanName().equals(bean.getBeanName());
}
示例7: isChangedBean
import org.springframework.beans.factory.NamedBean; //导入依赖的package包/类
public boolean isChangedBean(NamedBean bean) {
return bean != null && getBeanName().equals(bean.getBeanName());
}
示例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());
}