Make immutable copies of Traits when inserting into Context, and Context
when inserting into Traits. Also:

* replace TextUtils.getTrimmedLength() with text.trim().length()
* documentation updates
* traits cache returns a thread safe value and avoids reflection