Thanks Paul. I could get a simpler solution, created a method called
getTypeId for both the objects 

   #foreach ($branch in $cBranchList)
                #if($branch.BizObject.getTypeId().equals("TypeA"))
                #else
                #end
   #end

I haven't tried your solution, I guess it should work too. 



Paul Loy wrote:
> 
> Try doing a .class?
> 
> #foreach($item in $arrayList)
>     #set($classType = $item.class)
> 
>     #if ($classType == "com.domain.classname")
>         do something
>     #else
>         don't do it!
>     #end
> #end
> 
> (this code isn't tested... just in my head!)
> 
> rjain wrote:
>> I have a ArrayList which can contain either items of TypeA or TypeB
>>
>> #foreach($item in $arrayList) 
>>   #if ($item <isoftype> TypeA)
>>          Do something
>>   #else ($item <isoftype> TypeB)
>>          Do something else
>>   #end
>> #end
>>
>> How do I get the Type of Item in the Arraylist?
>>
>> Thanks!!
>>   
> 
> 
> -- 
> 
> *Paul Loy
> Software Developer*
> 
> Peoples Archive Ltd.
> Middlesex House
> 34-42 Cleveland Street
> London, W1T 4LB
> 
> Tel: +44 (0) 20 7323 0323
> Fax: +44 (0) 20 7580 1938
> [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-get-Type-of-variable-tf2608406.html#a7279296
Sent from the Velocity - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to