28
如何在速度模板中测试给定对象的类。我无法找到一个instanceof指令velocity(test instanceof)
如何在速度模板中测试给定对象的类。我无法找到一个instanceof指令velocity(test instanceof)
没有的instanceof,但你可以得到类名作为一个字符串,然后从那里:
${myObj.class.name} would return "com.test.MyObj"
${myObj.class.simpleName} would return "MyObj"
'我class.name'工作,但不是'类.simpleName',出于某种原因。 – 2016-09-01 00:19:09