Is it possible in Apache Velocity 1.7 to check if all keys specified in a VelocityContext
are valid for a template? For example, let's say I have a template, card.vm
, that looks like this:
card {
type: CREDIT
company: VISA
name: "${firstName} ${lastName}"
}
If I then execute the following code, it should throw an error since cardNumber
is not present in the card.vm
template:
VelocityContext context = new VelocityContext();
context.put("firstName", "tuk");
context.put("lastName", "man");
context.put("cardNumber", "1234");
StringWriter writer = new StringWriter();
t.merge(context, writer);