Java源码示例:org.springframework.beans.factory.config.MapFactoryBean
示例1
@Test
public void testCollectionFactoryDefaults() throws Exception {
ListFactoryBean listFactory = new ListFactoryBean();
listFactory.setSourceList(new LinkedList());
listFactory.afterPropertiesSet();
assertTrue(listFactory.getObject() instanceof ArrayList);
SetFactoryBean setFactory = new SetFactoryBean();
setFactory.setSourceSet(new TreeSet());
setFactory.afterPropertiesSet();
assertTrue(setFactory.getObject() instanceof LinkedHashSet);
MapFactoryBean mapFactory = new MapFactoryBean();
mapFactory.setSourceMap(new TreeMap());
mapFactory.afterPropertiesSet();
assertTrue(mapFactory.getObject() instanceof LinkedHashMap);
}
示例2
@Test
public void testCollectionFactoryDefaults() throws Exception {
ListFactoryBean listFactory = new ListFactoryBean();
listFactory.setSourceList(new LinkedList());
listFactory.afterPropertiesSet();
assertTrue(listFactory.getObject() instanceof ArrayList);
SetFactoryBean setFactory = new SetFactoryBean();
setFactory.setSourceSet(new TreeSet());
setFactory.afterPropertiesSet();
assertTrue(setFactory.getObject() instanceof LinkedHashSet);
MapFactoryBean mapFactory = new MapFactoryBean();
mapFactory.setSourceMap(new TreeMap());
mapFactory.afterPropertiesSet();
assertTrue(mapFactory.getObject() instanceof LinkedHashMap);
}
示例3
@Test
public void testCollectionFactoryDefaults() throws Exception {
ListFactoryBean listFactory = new ListFactoryBean();
listFactory.setSourceList(new LinkedList());
listFactory.afterPropertiesSet();
assertTrue(listFactory.getObject() instanceof ArrayList);
SetFactoryBean setFactory = new SetFactoryBean();
setFactory.setSourceSet(new TreeSet());
setFactory.afterPropertiesSet();
assertTrue(setFactory.getObject() instanceof LinkedHashSet);
MapFactoryBean mapFactory = new MapFactoryBean();
mapFactory.setSourceMap(new TreeMap());
mapFactory.afterPropertiesSet();
assertTrue(mapFactory.getObject() instanceof LinkedHashMap);
}
示例4
@Override
protected Class<?> getBeanClass(Element element) {
return MapFactoryBean.class;
}
示例5
@Override
protected Class<?> getBeanClass(Element element) {
return MapFactoryBean.class;
}
示例6
@Override
protected Class<?> getBeanClass(Element element) {
return MapFactoryBean.class;
}
示例7
@Override
protected Class<?> getBeanClass(Element element) {
return MapFactoryBean.class;
}
示例8
@Override
protected Class<?> getBeanClass(Element element) {
return MapFactoryBean.class;
}
示例9
@Override
protected String getBeanClassName(Element element) {
return MapFactoryBean.class.getName();
}