Re: [Simple-support] Unmodifiable ElementList / ElementMap option
Brought to you by:
niallg
|
From: Niall G. - Y. <Nia...@yi...> - 2013-06-14 00:23:29
|
Sure I will consider it for a future release, it should be a fairly simple change.
From: Lumsdon, Hugo [mailto:Hug...@bl...]
Sent: Thursday, 13 June 2013 10:10 PM
To: sim...@li...
Subject: [Simple-support] Unmodifiable ElementList / ElementMap option
Hi Niall,
We've mentioned this idea before and you don't seem to express any opinion / interest. However we'd love to be able to add an attribute to the ElementList and ElementMap annotations to indicate that these should be made immutable once an object has been de-serialized - i.e. wrapped using Collections.unmodifiableXXX.
The reason is we that we are caching most of our de-serialized Simple XML based beans - and as such don't want developers accidently trying to modify the objects thinking they're just updating a local copy.
We're currently doing this manually by creating unmodifiable wrappers to mirror each List or Map member variable. However, whilst trivial, this adds a fair amount of code bloat and the possibility devs forget to wrap the underlying collection. It would be so much tidier to just add a flag to the @ElementList or @ElementMap annotations and get the framework to handle it - and easier for us to search across the code base and make sure the flag is being set - i.e. along the lines of @ElementList(unmodifiable=true).
Please consider this as a future enhancement.
Thanks.
THIS MESSAGE AND ANY ATTACHMENTS ARE CONFIDENTIAL, PROPRIETARY, AND MAY BE PRIVILEGED. If this message was misdirected, BlackRock, Inc. and its subsidiaries, ("BlackRock") does not waive any confidentiality or privilege. If you are not the intended recipient, please notify us immediately and destroy the message without disclosing its contents to anyone. Any distribution, use or copying of this e-mail or the information it contains by other than an intended recipient is unauthorized. The views and opinions expressed in this e-mail message are the author's own and may not reflect the views and opinions of BlackRock, unless the author is authorized by BlackRock to express such views or opinions on its behalf. All email sent to or from this address is subject to electronic storage and review by BlackRock. Although BlackRock operates anti-virus programs, it does not accept responsibility for any damage whatsoever caused by viruses being passed.
BlackRock Advisors (UK) Limited and BlackRock Investment Management (UK) Limited are authorised and regulated by the Financial Conduct Authority. Registered in England No. 796793 and No. 2020394 respectively. BlackRock Life Limited is authorised by the Prudential Regulation Authority and regulated by the Financial Conduct Authority and Prudential Regulation Authority. Registered in England No. 2223202. Registered Offices: Drapers Gardens, 12 Throgmorton Avenue, London EC2N 2DL. BlackRock International Limited is authorised and regulated by the Financial Conduct Authority and is a registered investment adviser with the Securities and Exchange Commission (SEC). Registered in Scotland No. SC160821. Registered Office: 40 Torphichen Street, Edinburgh, EH3 8JB.
(c) 2013 BlackRock, Inc. All Rights reserved.
|