Caching mapped instances

Nomin by default caches mapped instances. It allows to improve performance in case of frequently repeating values to be mapped. Also caching mapped objects serves as a cycle detection mechanism to prevent infinite loop in case of bidirectional references.

Caching can be disabled. Actually this is required in rare cases. For example you would like to create a new object instance each time you call instead of getting a cached one. Also there is an interesting case when disabling cache is useful, please refer org.nomin.functional.MappingCasesTest.

To enable or disable caching just call the corresponding method on org.nomin.NominMapper as follows:

  // or