To my mind, what's misleading about the current setup is the inconsistent 
semantics. Other flavors of getEntityAsXXX return XXXRepresentation: 

DomRepresentation getEntityAsDom() 
SaxRepresentation getEntityAsSax() 

By association, developers may intuit that getEntityAsObject should 
automatically return ObjectRepresentation, when in fact it returns null unless 
the entity is associated with an Application (e.g. is an incoming request 
routed through an Application) and the developer has set up a custom Converter 
attached to the Application. One might observe that given the Javadoc and the 
fact that it returns Object and not ObjectRepresentation, this difference 
should be obvious, but the discussion here proves it's not. 

I'd seriously propose something like this; although it breaks API 
compatibility, I think it's the right thing to do for semantic consistency. 

ObjectRepresentation getEntityAsObject() -- works like getEntityAsDom() and 
getEntityAsSax() 
Object getConvertedEntity() -- works like the current getEntityAsObject() 

I hope that although Restlet has reached a 1.0 release, the API won't be 
prematurely ossified ... as more developers work with the code in real life, 
some points of confusion like this will need to get addressed in ways that 
aren't reverse compatible. 


----- Original Message ----- 
From: "Stanczak Group" <[EMAIL PROTECTED]> 
To: discuss@restlet.tigris.org 
Sent: Thursday, August 23, 2007 9:11:44 AM (GMT-0500) America/New_York 
Subject: Re: getEntityAsObject()? 

This works, thanks. I still don't understand why getEntityAsObject() is 
even there. 

Reply via email to