Skip to Content
0
Sep 14, 2017 at 05:47 PM

How to define a bean with a property List of type E?

340 Views

I created an addon and I want to define the following classes in my beans.xml:

 public  class Sector
 {    
     private String sectorId;    
     private String sectorName;
     
     public void setSectorId(final String sectorId)
     {
         this.sectorId = sectorId;
     }
 
     public String getSectorId() 
     {
         return sectorId;
     }
     
     public void setSectorName(final String sectorName)
     {
         this.sectorName = sectorName;
     }
 
     public String getSectorName() 
     {
         return sectorName;
     }
 }
 
 public  class SectorResponse
 {
     private List<Sector> sectors;
     
     public void setSectors(final List sectors)
     {
         this.sectors = sectors;
     }
     public List getSectors() 
     {
         return sectors;
     }
     
 }

I made the following definitions in my beans.xml:

 <bean class="customstorefront.dto.stockinventory.SectorResponse">
     <description>Data object for sector response</description>
     <property name="sectors" type="java.util.List"></property>
 </bean>
 <bean class="customstorefront.dto.stockinventory.Sector">
     <description>Data object for sector POJO</description>
     <property name="sectorId" type="java.lang.String"></property>
     <property name="sectorName" type="java.lang.String"></property>
 </bean>

But my SectorResponse's property sectors is created as a List type, how can I define it inside my beans.xml to have it created as List<Sector>?