Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

velocity (test instanceof)

Tags:

velocity

How can I test the class of a given object in a velocity template. I can't find an instanceof directive

like image 731
Amira Avatar asked Jun 21 '10 17:06

Amira


1 Answers

There is no instanceof, but you can get class name as a string and then go from there:

${myObj.class.name} would return "com.test.MyObj" ${myObj.class.simpleName} would return "MyObj" 
like image 154
serg Avatar answered Sep 19 '22 22:09

serg