abdera-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Duncan" <stephen.dun...@gmail.com>
Subject Re: API Refactoring
Date Thu, 22 Jun 2006 21:26:34 GMT
Seems like the MimeType should be the second parameter, not the first.
 At least, that's my preferred style; optional parameters are tacked
on after, required ones...

- Stephen

On 6/22/06, James M Snell <jasnell@gmail.com> wrote:
> There are a number of API refactorings that I've been meaning to do for
> a while to simplify the way entry content and text elements are set.
> Whereas currently the API has a whole bunch of methods like
> entry.setContentAsText(...), entry.setContentAsXhtml(...), etc, the
> refactoring I have ready to check in changes it to just a limited
> handful of setContent(...) methods with various options.  The same kind
> of refactoring is applied to all of the various
> setTitle/setRights/setSubtitle/setSummary methods. This refactoring also
> affects content/text related methods in the Factory interface.
>
> //<content type="text">Testing</content>
> content = entry.setContent("Testing");
>
> //<content type="html">&lt;p>Testing&lt;/p></content>
> content = entry.setContent(Content.Type.HTML, "<p>Testing</p>");
>
> //<content type="xhtml">
> //  <div xmlns='http://www.w3.org/1999/xhtml'>Testing</div>
> //</content>
> content = entry.setContent(
>   Content.Type.XHTML,
>   "<div xmlns='http://www.w3.org/1999/xhtml'>Testing</div>");
>
> //<content type="application/xml"><a><b /></a></content>
> content = entry.setContent(
>   new MimeType("application/xml"),
>   "<a><b/></a>");
>
> //<content type="text/plain">foo</content>
> content = entry.setContent(new MimeType("text/plain"), "foo");
>
> //<content type="image/png">{base64}</content>
> content = entry.setContent(
>   new MimeType("image/png"),
>   new DataHandler(new ByteArrayDataSource("foo".getBytes())));
>
> //<content type="image/png" src="http://foo" />
> content = entry.setContent(
>   new MimeType("image/png"), new URI("http://foo"));
>
> Thoughts? Complaints? Concerns before I check it in?
>
> - James
>
>


-- 
Stephen Duncan Jr
www.stephenduncanjr.com

Mime
View raw message