Per Nyfelt wrote: > > > The idea with getContent was to make it possible to work with the > > default representation of multiple resource types without calling a > > special method. For XMLResource the default behaviour for getContent is > > to always return a string. > If it is the default behaviour how would you instruct it to return an object > of another type?
Sorry default was a bad choice of term. That is the behavior of that method it doesn't change. XMLResource ALWAYS returns String from getContent and accepts String in setContent. If you're storing the value internally in some other format then you must serialize it to text when getContent is called. > To me it looks like it was supposed to return a String but for some reason > Object was chosen to make it possible at a later point to instruct the > resource to return another type of object than String. > That option was not the final direction so instead you have > getContentAsDOM() etc. getContent and setContent are defined on the Resource interface which has no knowledge of what type the extending interface is going to want to return. > > > > Are you suggesting getContentAsText() should be in addition to > > getContent() or should replace it? I agree it would be clearer in the > > XMLResource context but I like the idea of as long as you have a > > Resource you can call getContent to get the default representation. > > > > Anyone else have any thoughts on this? > What about changing the return type for getContent() to String? then there > wouldn't be a need for a getContentAsText()? If you did this how would you use getContent on a BinaryResource? > > Best regards, > Per > > ---------------------------------------------------------------------- > Post a message: mailto:[EMAIL PROTECTED] > Unsubscribe: mailto:[EMAIL PROTECTED] > Contact adminstrator: mailto:[EMAIL PROTECTED] > Read archived messages: http://archive.xmldb.org/ > ---------------------------------------------------------------------- -- Kimbro Staken The dbXML Project http://www.dbxml.org/ ---------------------------------------------------------------------- Post a message: mailto:[EMAIL PROTECTED] Unsubscribe: mailto:[EMAIL PROTECTED] Contact adminstrator: mailto:[EMAIL PROTECTED] Read archived messages: http://archive.xmldb.org/ ----------------------------------------------------------------------
