cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

How to create map attribute using *-items.xml ?

Former Member
0 Likes
2,410

Hi Team,

I have a requirement to create an attribute of Map> type for my productConcept model. I was trying to do like the below one and other 2 ways

 <maptype code="ParamTypeMap"
                 argumenttype="java.lang.String"
                 returntype="java.util.List"
                 autocreate="true"
                 generate="false"/>



but if I am adding Java.util.List in my items.xml file then always its giving build error : list is not a valid type.

So please suggest me how I can create a map type attribute.

Thanks, Kesari Sapient corporation.

View Entire Topic
Former Member
0 Likes

Kesari,

You need to define something like this

 <collectiontypes>

 <collectiontype code="MyListCode" elementtype="java.lang.String" autocreate="true" generate="true"
                     type="list"/>
 </collectiontypes>



 <maptype code="ParamTypeMap" argumenttype="java.lang.String"
         returntype="MyListCode" generate="true" autocreate="true" />
 </maptypes>

In the collection MyListCode you can define element type corresponding to the type you are going to store in the list collection.

Thanks,

Former Member
0 Likes

Thanks Vikramjit for your reply.

I have implemented the code as you have mentioned and it's working fine.

Kesari, Tech L2, Sapient Corporation

Former Member
0 Likes

Kindly accept the answer if it solves your problem :d