Reputation: 263
What is the simplest implementation to restrict values to a property?
property name="prop_name" value="${dynamic_value}
I want to have the values to ${dynamic_value}
from a restricted set.
Thanks, Wajid
Upvotes: 0
Views: 268
Reputation: 10377
You may use a scriptcondition (see ant manual conditions) with builtin javascript engine
(included in Java >= 1.6.x), f.e. :
<project>
<property name="foo" value="26"/>
<fail message="Value of $${foo} not in range => [${foo}] !">
<condition>
<scriptcondition language="javascript">
var foo = parseInt(project.getProperty("foo"));
self.setValue(foo <= 20 || foo >= 25);
</scriptcondition>
</fail>
</project>
Upvotes: 1