posts - 0,  comments - 5,  trackbacks - 0
 接口类ListService
@SuppressWarnings("unchecked")
public interface ListService
{
    
public List getString();
    
public List getListofListofString();
    
public Map getStringMap(Map map);
    
public Map getMapofMapofString(Map map);
}

  实现接口类ListServiceImp
@SuppressWarnings(
"unchecked")
public class ListServiceImp implements ListService
{
    
public List getListofListofString()
    
{
        List list 
= new ArrayList();
        
for(int i=0; i<5; i++)
        
{
            list.add(getString());
        }

        
return list;
    }


    
public List getString()
    
{
        List list 
= new ArrayList();
        
for(int i=0; i<5; i++)
        
{
            list.add(i
+"==");
        }

        
return list;
    }


    @Override
    
public Map getMapofMapofString(Map mapP)
    
{
        Map map 
= new HashMap();
        Iterator it 
= mapP.keySet().iterator();
        
while(it.hasNext())
        
{
            
int key = (Integer)it.next();
            map.put(key, getStringMap(mapP));
        }


        
return map;
    }


    @Override
    
public Map getStringMap(Map mapP)
    
{
        Map map 
= new HashMap();
        Iterator it 
= mapP.keySet().iterator();
        
while(it.hasNext())
        
{
            
int key = (Integer)it.next();
            
int value = (Integer)mapP.get(key);
            map.put(key, value
+":"+value);
        }

        
return map;
    }

}

集合对象绑定ListService.aegis.xml 此文件写接口名一样
<?xml version="1.0" encoding="UTF-8"?>  
<mappings>  
    
<mapping>  
        
<method name="getString">
              
<return-type componentType="java.lang.String" />
        
</method>
        
        
<method name="getListofListofString">
              
<return-type componentType="#someString" />
        
</method>
        
<component name="someString" class="java.util.List"  componentType="java.lang.String" />
        
        
<method name="getStringMap">
              
<return-type componentType="java.lang.String" />
        
</method>
        
        
<method name="getMapofMapofString">
              
<return-type componentType="#someMap" />
        
</method>
        
<component name="someMap" class="java.util.Map"  componentType="java.lang.String" />
        
    
</mapping>  
</mappings>  

可以参考http://dist.codehaus.org/ xfire/ sources/ xfire-src-1.1.2.zip/ xfire-1.1.2/ xfire-aegis/ src/ test/ org/ codehaus/ xfire/ aegis/ type/ collection/中的代码看看
posted on 2008-06-25 19:47 crazy 阅读(728) 评论(0)  编辑  收藏 所属分类: java

只有注册用户登录后才能发表评论。


网站导航: