xfire 集合 aegis

来源:互联网 发布:教务管理数据库 编辑:程序博客网 时间:2024/05/06 18:42
fire 集合 aegis
 接口类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>  

原创粉丝点击