On Jan 9, 2010, at 1:25 PM, Pascal Voitot wrote:
does it mean all scripts using the older functions
will need to be updated?
There's only one gotcha right now with what I have on my machine (not committed) and
I'm still hesitating. Internally I've modified the field containing the objects
from
private Map<String, Vector<BaseObject>> objects
to
private Map<DocumentReference, List<BaseObject>> objects
This means that the old (deprecated APIs) have to wrap the internal map. For example when
XWikiDocument.getxWikiObjects() is called it returns a new Map, copying the internal map
to a map of type Map<String, Vector<BaseObject>>. The problem is that if you
have code like the following it'll now fail:
getxWikiObjects().put(something)
Then calling getxWikiObjects() again will not contain the "something" object.
IMO it's a bad usage of the API. Instead if you wish to add something you should call
addObject (now addXObject) for example. However it was allowed and will break old code
which would need to be modified to work.
WDYT? I don't see any solution to preserve the old behavior and at the same time move
to Map<DocumentReference, List<BaseObject>> objects
Thanks
-Vincent
Pascal
On Sat, Jan 9, 2010 at 12:43 PM, Vincent Massol <vincent(a)massol.net> wrote:
> Hi devs,
>
> As I mentioned already I'm modifying all APIs in XWikiDocument to use
> References (I'm adding new APIs and deprecating old ones).
>
> While doing this I'm also fixing names for new APIs. So far I'm modifying 3
> things:
> - replace Vector by List
> - replace Object by XObject in API. For example: getxWikiObjects() -->
> getXObjects(), getObjects(String classname) -->
> getXObjects(DocumentReference classnameReference)
> - replace Class by XClass in API. For example: getxWikiClasses -->
> getXClasses()
>
> Note1: I wanted to use getObject and getClass but getClass is reserved
> already.
> Note2: in the new model we won't have this problem since we'll
> intelligently use another name for object definitions, something like
> ObjectDefinition :). We could also change Object but it's less problematic
> and it's probably ok to keep it.
>
> Here's my +1
>
> Thanks
> -Vincent