Document that need to implement hashCode/equals for customLookupCondition
Generates text that depends on changing data (like dynamic HTML).
Brought to you by:
revusky
From the latest release:
"Added new Configuration.getTemplate(...) parameter, Object customLookupCondition."
This was awesome, and we used it to choose a mobile version of a template if one is available, but I forgot to implement hashcode/equals on my my custom lookup obj, which caused the template cache to think every template key was unique and we rapidly ran out of memory :)
Probably worth calling out in the documentation that you need to remember hashcode/equals. Thanks!
As a matter of fact, the JavaDoc of
customLookupConditionsays: "This object will be used as part of the cache key, so it must to have a proper {@link Object#equals(Object)} and {@link Object#hashCode()} method. It also should have reasonable {@link Object#toString()}, as it's possibly quoted in error message". But I have added notices on more places now.Weird, I searched the Javadoc before posting this, I must have just missed it. Thanks!
(also glad you reposted that here because I hadn't added toString())