本文整理汇总了Java中java.beans.beancontext.BeanContextSupport.addBeanContextMembershipListener方法的典型用法代码示例。如果您正苦于以下问题:Java BeanContextSupport.addBeanContextMembershipListener方法的具体用法?Java BeanContextSupport.addBeanContextMembershipListener怎么用?Java BeanContextSupport.addBeanContextMembershipListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.beans.beancontext.BeanContextSupport
的用法示例。
在下文中一共展示了BeanContextSupport.addBeanContextMembershipListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSerialization_NoPeer
import java.beans.beancontext.BeanContextSupport; //导入方法依赖的package包/类
public void testSerialization_NoPeer() throws IOException,
ClassNotFoundException {
BeanContextSupport support = new BeanContextSupport(null, Locale.ITALY,
true, true);
support
.addBeanContextMembershipListener(new MockBeanContextMembershipListener());
support
.addBeanContextMembershipListener(new MockBeanContextMembershipListenerS(
"l2"));
support
.addBeanContextMembershipListener(new MockBeanContextMembershipListenerS(
"l3"));
support
.addBeanContextMembershipListener(new MockBeanContextMembershipListener());
support.add("abcd");
support.add(new MockBeanContextChild());
support.add(new MockBeanContextChildS("a child"));
support.add(new MockBeanContextChild());
support.add("1234");
support.add(new MockBeanContextProxyS("proxy",
new MockBeanContextChildS("b child")));
assertEqualsSerially(support, (BeanContextSupport) SerializationTester
.getDeserilizedObject(support));
}
示例2: testSerialization_Compatibility
import java.beans.beancontext.BeanContextSupport; //导入方法依赖的package包/类
public void testSerialization_Compatibility() throws Exception {
MockBeanContextDelegateS mock = new MockBeanContextDelegateS("main id");
BeanContextSupport support = mock.support;
support.addBeanContextMembershipListener(new MockBeanContextMembershipListener());
support.addBeanContextMembershipListener(new MockBeanContextMembershipListenerS("l2"));
support.addBeanContextMembershipListener(new MockBeanContextMembershipListenerS("l3"));
support.addBeanContextMembershipListener(new MockBeanContextMembershipListener());
support.add("abcd");
support.add(new MockBeanContextChild());
support.add(new MockBeanContextChildS("a child"));
support.add(new MockBeanContextChild());
support.add("1234");
MockBeanContextDelegateS serMock = (MockBeanContextDelegateS) SerializationTester
.readObject(mock, "serialization/java/beans/beancontext/BeanContextSupport.ser");
assertEquals(mock.id, serMock.id);
assertSame(mock, mock.support.beanContextChildPeer);
assertSame(serMock, serMock.support.beanContextChildPeer);
assertEqualsSerially(mock.support, serMock.support);
}
示例3: testSerialization_Peer
import java.beans.beancontext.BeanContextSupport; //导入方法依赖的package包/类
public void testSerialization_Peer() throws IOException,
ClassNotFoundException {
MockBeanContextDelegateS mock = new MockBeanContextDelegateS("main id");
BeanContextSupport support = mock.support;
support
.addBeanContextMembershipListener(new MockBeanContextMembershipListener());
support
.addBeanContextMembershipListener(new MockBeanContextMembershipListenerS(
"l2"));
support
.addBeanContextMembershipListener(new MockBeanContextMembershipListenerS(
"l3"));
support
.addBeanContextMembershipListener(new MockBeanContextMembershipListener());
support.add("abcd");
support.add(new MockBeanContextChild());
support.add(new MockBeanContextChildS("a child"));
support.add(new MockBeanContextChild());
support.add("1234");
support.add(new MockBeanContextProxyS("proxy",
new MockBeanContextChildS("b child")));
MockBeanContextDelegateS serMock = (MockBeanContextDelegateS) SerializationTester
.getDeserilizedObject(mock);
assertEquals(mock.id, serMock.id);
assertSame(mock, mock.support.beanContextChildPeer);
assertSame(serMock, serMock.support.beanContextChildPeer);
assertEqualsSerially(mock.support, serMock.support);
}